How to enable debug log

What Is debug.log?

The debug.log file is a log that captures PHP errors, warnings, and notices generated by your WordPress site. By enabling it, you can gain insights into what’s happening behind the scenes and troubleshoot issues effectively.

Steps to Enable debug.log:

1. Access Your wp-config.php File

  • Log in to your server via SSH or FTP.
  • Locate the wp-config.php file in your WordPress installation directory.

2. Edit wp-config.php

  • Open the wp-config.php file using your preferred text editor (e.g., Notepad++, Visual Studio Code, or any other).
  • Scroll down to find the following section
// Enable WP_DEBUG mode 
define('WP_DEBUG', true);
  • To enable debug.log file, modify it as follows:
// Enable WP_DEBUG mode 
define('WP_DEBUG', true); 
define('WP_DEBUG_DISPLAY', false); 
// Hide errors on the page 
define('WP_DEBUG_LOG', true);

3. Save and upload

Save the changes to your wp-config.php and then upload the file back.

4. Verify

There are few optional steps to verify if debug.log is enabled:

  • Visit your WordPress site and try to reproduce the issue you had previously.
  • Check if the debug.log file is present in wp-content folder.
  • Errors and warnings will be logged into this file.