Activate and Display Debug Logs for WordPress

Debug logs in WordPress provide crucial information about errors, warnings, and notices that occur on your website. Enabling debug logs can help you identify and resolve issues quickly.

What Are WordPress Debug Logs?

WordPress debug logs are files that record various types of errors and warnings that occur on your website. These logs are essential for troubleshooting issues with plugins, themes, or core WordPress functions.

To activate debug logging in WordPress, you’ll need to modify your wp-config.php file. This file is located in your WordPress installation’s root directory.

  1. Add Debug Constants: Open your wp-config.php file and add the following code before the line that says /* That's all, stop editing! */:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
  1. Create Debug Log File: WordPress will automatically create a debug.log file in the wp-content directory. If the file doesn’t exist, you can create it manually:
  • Navigate to your wp-content directory
  • Create a new file named debug.log
  • Set the file permissions to 644

Accessing and Reading Debug Logs

Once enabled, you can access your debug logs in several ways:

Through File Manager:

  • Navigate to your wp-content directory
  • Open the debug.log file
  • Review the logged information chronologically

Via FTP:

  • Connect to your server using FTP credentials
  • Browse to the wp-content directory
  • Download and open the debug.log file

Understanding Debug Log Entries

Debug log entries follow a specific format:

[Date and Time] Type of Error: Error Message (File Path: Line Number)

Common log entry types include:

  • PHP Fatal errors: Critical issues that stop script execution
  • PHP Warnings: Non-critical issues that don’t stop execution
  • PHP Notices: Suggestions for code improvement
  • WordPress-specific errors: Issues related to WordPress functions