All tutorials
WordPress

Find the Root Cause in a WordPress debug.log

5 min readFormatHubTools Tutorials

A fatal error usually names the plugin and file responsible. Learn how to pull that line out of a noisy debug log.

  1. 1

    Turn debugging on

    Add define('WP_DEBUG', true); and define('WP_DEBUG_LOG', true); to wp-config.php. WordPress then writes errors to wp-content/debug.log instead of printing them on the page.

  2. 2

    Copy the relevant chunk

    Open the debug.log file and copy the section around the timestamp where the site went down. You rarely need the entire file, a few hundred lines around the failure is plenty.

  3. 3

    Parse it into clean entries

    Paste the snippet into the WordPress Debug Log Parser. PHP notices, warnings, fatal errors and database errors are split into readable blocks, and stack traces are indented under the line that triggered them.

  4. 4

    Read the path in the trace

    The stack trace lists the files that led to the failure. The topmost path inside wp-content/plugins or wp-content/themes is almost always the culprit. A fatal error naming a plugin file is usually a version conflict or a PHP version mismatch.

  5. 5

    Confirm before changing anything

    Deactivate or update that plugin on a staging copy first, then check whether the error stops appearing. Keep a copy of the cleaned log in the ticket so the next person can follow the same path.

Ready to try it? Open the WordPress Parser and paste your data.

WordPress Parser