Where your WP logs are, and how to read them

WP keeps one log of its own, and only once you switch it on. Here's where it lives, how to turn it on, what your host keeps, and how to read a line.

Download the free plugin

Needs WP 6.3 to 7.1 and PHP 8.0 or newer. What it installs

Needs WP 6.3 to 7.1, PHP 8.0 or newer, and an administrator login. One site per install.

The download is a plugin. Turning it on connects your site to cmshands.com and adds 3 small rescue files. Deleting the plugin removes them and everything it stored. What we send

Plugins are installed from a computer. Get the plugin here instead

  • Nothing changes without your OK
  • Undo in one click, or a warning first
  • No account, no password to share

WP has no log screen in your dashboard: the screens you log in to at yoursite.com/wp-admin. Its errors go to a file instead, and only after you switch logging on. Your host keeps 2 more logs of its own.

Where CMSHands fits. CMSHands is a free plugin that adds a chat to your WP dashboard. Ask it “What are the errors on my site?” and it reads your debug log and says what each line means. Questions are free, 30 a day (100 with your email).

The logs a WordPress site has

1. The WP debug log

WP writes PHP errors, warnings and notices to wp-content/debug.log. PHP is the language WP runs on; your host sets its version. WP only writes this file when WP_DEBUG_LOG is on in wp-config.php.

If your WP_DEBUG_LOG line holds a file path instead of true, the log is at that path. Some people move it outside the site's public folder, so no visitor can open it.

2. Your host's PHP error log

PHP can log errors without WP's help. Where it writes them is a hosting setting. On many hosts it's a file called error_log in your site's main folder. Others show it in the hosting panel, under a name like Logs or Errors.

3. Your host's access log

This one records every visit: the address, the time and a status code. 404 means the page wasn't found; 500 means the server failed. Your host keeps it, not WP. Look for Access log or Raw access in your hosting panel.

What WP doesn't log

WP keeps no record of who logged in or changed a setting. Posts and pages keep revisions, which show who edited the text and when. For logins and settings, you need an activity log plugin.

How to turn on the WordPress debug log

Open wp-config.php in your site's main folder, with your host's file manager or SFTP. Copy the file to your computer first, so you can put it back.

Find the line define( 'WP_DEBUG', false ); and change false to true. Right under it, add define( 'WP_DEBUG_LOG', true ); and define( 'WP_DEBUG_DISPLAY', false ); on 2 lines.

No WP_DEBUG line at all? Add all 3 lines above the one that says /* That's all, stop editing! Happy publishing. */. Don't add a second WP_DEBUG line: PHP warns when a setting is defined twice.

WP_DEBUG_DISPLAY set to false keeps the errors off your pages, so visitors don't see them. They go to the file only.

Now load the page that misbehaves. Then open wp-content/debug.log in the file manager. The newest lines are at the bottom.

When you're done, set WP_DEBUG back to false and delete debug.log. On many servers, anyone who knows its address can open it in a browser.

How to read a line

Each line starts with the date and time in square brackets. Then come the kind of error, the message, the file and the line number.

The kind tells you how bad it is. PHP Fatal error stopped the page from loading. PHP Warning and PHP Notice mean PHP noted a problem and carried on. PHP Deprecated means the code uses something a later PHP version will drop.

The file path tells you whose code it is. A path with wp-content/plugins/ and a folder name points at that plugin. One with wp-content/themes/ points at your theme. One with wp-includes or wp-admin is WP itself, but the cause is often a plugin calling it.

The same line written over and over is usually one problem, not many. Look at the time stamps. They often line up with a page someone opened or a job WP ran.

What it looked like on our test site

Logging was off on our test site: a WP site we run to try every task before we write about it. We turned it on. Our real plugins logged nothing, so we added a small plugin that writes a warning on the Cart page. Then we opened that page 3 times.

We asked CMSHands “Read my site's log and tell me what's in it.” It read the error log and listed the site's plugins and themes.

It found 3 lines, all the same PHP warning, “undefined array key gift_wrap”, from that one plugin. It said the line is written when a cart page is opened.

It said a warning isn't an error: PHP notes a missing setting and carries on, so pages still load. It offered to suggest switching the plugin off.

Nothing changed, because we only asked. Afterwards we switched logging off and removed the test plugin.

When the log points at a plugin

Open Plugins › Installed Plugins. If that plugin has a new version waiting, update it and check whether the line stops.

If there's no update, switch the plugin off and load the same page again. No new line means you found it. Tell the plugin's author: its page at wordpress.org has a Support tab.

If your site breaks

If CMSHands was on your site before it broke, it reads your error log and settings to find the cause. That's why it's worth installing while your site still works.

Questions

Where are WordPress logs?

WP's own log is wp-content/debug.log, once logging is on. If your WP_DEBUG_LOG line names a file path, it's at that path instead. Your host keeps the PHP error log and the access log. Find them in your hosting panel under a name like Logs or Errors.

Does WordPress keep logs by default?

No. Out of the box, WP writes no log of its own. Your server may still log PHP errors to a file your host chooses. To get WP's log, set WP_DEBUG and WP_DEBUG_LOG to true in wp-config.php, and WP_DEBUG_DISPLAY to false.

Is it safe to leave the debug log on?

Not for long. The file grows with every error, and on many servers anyone who knows its address can open it. Keep WP_DEBUG_DISPLAY at false while it's on. When you're done, switch it off and delete debug.log, or point WP_DEBUG_LOG at a file outside your public folder.

Does WordPress log who logged in or changed things?

No. WP keeps no activity log of logins or settings. Posts and pages keep revisions, which show who changed the text and when. For logins, settings and plugin changes, you need an activity log plugin from the WP plugin directory.

Can CMSHands read my logs?

Yes, the WP debug log. Ask “What are the errors on my site?” and it reads the file and says what each line means. It can't switch logging on from the chat, and your host's access log stays in your hosting panel. A question changes nothing on your site.

Written by CMSHands team.

Try it on your own site

  • Nothing changes without your OK
  • Undo in one click, or a warning first
  • No account, no password to share
Download the free plugin