Black FridayCyber Monday 2026
14Days
15Hrs
34Mins
45Secs
Flat20% OFF

Our biggest sale of the year20% off the first payment on all maintenance plans. Code BF2026

Grab the deal
WordPress

How to Read the WordPress Debug Log (debug.log) Safely

The debug log names the file and line behind many WordPress errors. Learn to turn it on safely, read what it says and switch it off when you are done.

wpallsolution 6 min read

The WordPress debug log is a text file where WordPress records PHP errors, warnings and notices instead of showing them on the page. When a site shows a white screen, a critical error or a feature that silently fails, the log often names the exact file and line behind the problem, which is usually inside a plugin or a theme. This guide shows how to turn the log on safely, read the entries, act on what you find and, importantly, turn it off again, because a debug log left on can leak information.

Quick answer

Add three lines to wp-config.php: turn on WP_DEBUG, turn on WP_DEBUG_LOG and set WP_DEBUG_DISPLAY to false so errors go to the file and not to visitors. Reproduce the problem, open wp-content/debug.log and read the newest entries at the bottom, looking at the file path and line number. When you have the information, turn debugging off and remove or protect the log file. Do this on a staging copy if you can, and back up first.

How this guide was prepared: it is research-based. We used the WordPress debugging documentation and the Site Health documentation listed under Sources, checked on October 23, 2026. We did not read your log, and the log content depends on your site, so treat the steps as a safe method, not a guaranteed fix.

What the debug log is

The WordPress debugging guide describes the constants involved. WP_DEBUG turns on debug mode and defaults to false. WP_DEBUG_LOG saves errors to wp-content/debug.log (or to a path you give) and requires WP_DEBUG. WP_DEBUG_DISPLAY controls whether errors appear in the page, defaults to true, and should be set to false when you want to log without showing errors to visitors. The guide calls these tools meant for local testing and staging, and advises backing up or using a staging copy before changing a site. WordPress’s own Site Health screen warns when errors are logged to a potentially public file, and when errors are displayed to visitors, because debug output can contain sensitive information.

The decision tree: should you turn on the debug log?

Flowchart for using the WordPress debug log: five questions about the problem, staging, on-screen errors, reproducing it and switching logging off
Five questions keep debugging useful and safe.
  1. White screen, critical error or broken feature? The log may name the file and line (Step 1).
  2. Cannot test on staging? Back up first and keep logging short (Step 2).
  3. Errors shown to visitors? Hide them and log instead (Step 2).
  4. Can you reproduce the problem? Do it, then read the newest entries (Step 3).
  5. Log still on when you finish? Switch it off and protect the file (Step 6).

6 steps to use the WordPress debug log safely

Step 1: Decide that you need it, and back up

Use the log when something fails without a clear reason. For a site that is down, a critical error often shows an admin email with details; see WordPress critical error: recover your website safely. Take a backup before you edit wp-config.php; see is your WordPress backup really safe.

Step 2: Enable logging without showing errors to visitors

Open wp-config.php and add these lines above the line that says to stop editing:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

Use the boolean true or false without quotes, because the guide warns that a quoted 'false' is read as true. Save, and keep a note of the time you turned it on.

Step 3: Reproduce the problem

Do the thing that fails (open the page, press the button, run the import) so WordPress writes entries about it. A log full of old notices is hard to read, so if the file is already large, rename it first so that you start with a clean one.

Step 4: Read the newest entries

Open wp-content/debug.log in your file manager or over SFTP and go to the bottom. Entries carry a date, a type such as Fatal error, Warning, Notice or Deprecated, a message and a file path with a line number. The most useful line for a break is usually a fatal error. A path containing wp-content/plugins/plugin-name or a theme folder points at the code that was running, which is not always the root cause, but it tells you where to start. Notices and deprecation messages are usually harmless noise unless they match your problem.

Step 5: Act on what you find

Update the plugin or theme, replace it, or send the developer the exact message and line. If a plugin is the cause, see how to find the plugin that broke your site and WordPress plugin conflict. For a memory message, read Allowed memory size exhausted. When you share log lines, remove file paths that reveal private details and never share passwords or keys.

Step 6: Switch logging off and protect or remove the file

When you have what you need, set WP_DEBUG to false, remove the extra lines and delete or move debug.log. The log can contain file paths and other details you do not want public, and it sits in a web-accessible folder by default. Leaving debugging on in production also costs performance.

Version and hosting differences

  • Your host may keep its own PHP error log, visible in the hosting panel, which also helps.
  • Some hosts disable or relocate the log file, or block writing to wp-content.
  • The WP_DEBUG_LOG option accepts a custom path outside the public folder, which the guide describes.

How to verify you used it safely

  • Visitors saw no error messages while it was on.
  • The log is now off, and the file is removed or protected.
  • Site Health no longer warns about logging or displaying errors.

Common mistakes

  • Leaving WP_DEBUG_DISPLAY true on a live site.
  • Writing 'false' in quotes.
  • Pasting the whole log, with private details, into a public forum.
  • Forgetting to switch it off.

Frequently asked questions

Where is the WordPress debug log?

By default in wp-content/debug.log once WP_DEBUG_LOG is on and something has been logged.

Is it safe to leave it on?

No. It can expose information and slow the site. Turn it off after use.

The file is empty. Why?

Nothing has been logged yet, writing may be blocked, or the problem is not a PHP error.

Do warnings mean my site is broken?

Not necessarily. Many warnings and notices are harmless, so match entries to the problem you are chasing.

What to do next

Turn the log on briefly, reproduce the problem, read the newest entries and then switch it off. If the log points to something you cannot fix, wpallsolution offers plugin support and an emergency WordPress fix. We cannot promise a result without seeing your log and setup.

Sources and official documentation

Keep reading

More guides

Need a hand with this?

Tell us what is happening. We reply with honest next steps.

Talk to us