Skip to main content

How to Find and Read the WordPress Debug Log

You can locate and view the WordPress debug log to identify specific errors, warnings, and notices occurring on your site. This process allows a Site Administrator to pinpoint the cause of issues like the "White Screen of Death" or other backend...

You can locate and view the WordPress debug log to identify specific errors, warnings, and notices occurring on your site. This process allows a Site Administrator to pinpoint the cause of issues like the "White Screen of Death" or other backend failures within the WordPress environment.

Before you begin

You will need:

  • Administrator access to your WordPress site.

  • Access to your site's files via an FTP client or a File Manager (such as those provided in your hosting control panel).

  • Access to the wp-config.php file located in your WordPress root directory.

Locate the debug log file

The location of the debug log depends on whether the WP_DEBUG_LOG constant is enabled in your configuration.

  1. Access your site's files using an FTP client or File Manager.

  2. Navigate to the root directory of your WordPress installation (usually public_html or www).

  3. Locate the wp-config.php file.

  4. Open the file and search for the following lines:

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );

  5. If WP_DEBUG_LOG is set to true, the log file is typically located in the wp-content folder.

  6. Navigate to wp-content/ and look for a file named debug.log.

Read the debug log

Once you have located the debug.log file, you can open it to review the recorded errors.

  1. Open the debug.log file using a text editor.

  2. Scroll to the bottom of the file to see the most recent entries.

  3. Look for lines starting with PHP Notice, PHP Warning, or PHP Fatal error.

  4. Identify the file path and line number provided in the error message to determine which plugin or theme is causing the issue.

Warning: Only enable WP_DEBUG and WP_DEBUG_LOG for troubleshooting purposes. Leaving these settings enabled on a live production site can expose sensitive system information to the public.

If you cannot find the debug.log file

If the file does not exist in the wp-content folder, it usually means the logging feature is not enabled.

  1. Open your wp-config.php file.

  2. Ensure the following lines are present and set to true:

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );

  3. Save the file and refresh the page on your website where the error is occurring.

  4. Refresh the page several times to trigger the error again, then check the wp-content folder for the newly generated debug.log file.

Limitations

The debug.log file only records errors that occur while the WP_DEBUG constant is set to true. If you are looking for errors that occurred before you enabled these settings, they will not appear in the log. Additionally, some hosting environments may have specific security configurations that prevent the creation of log files in certain directories.

Did this answer your question?