Sometimes we are unable to reproduce a problem a user is encountering when using the WP Security Audit Log plugin. In such cases we would require more information from the user’s WordPress website, which can be found in a log file. These log files can be generated by enabling the WordPress debug.
Note that debugging (the process of finding and resolving issues in software) is disabled by default in WordPress and should not be enabled on live websites. However it can be enabled temporarily to troubleshoot issues.
Enabling WordPress Debugging
When we ask you for the debug log file you should:
- Enable WordPress debug by setting the WP_DEBUG switch in the wp-config.php file to true, as per the following example:
- define( ‘WP_DEBUG’, true );
- Enable the generation of the debug log file by adding the following line to the wp-config.php file:
- define( ‘WP_DEBUG_LOG’, true );
By default the WordPress debug log file is called debug.log and is created in the /wp-content/ WordPress sub directory. Once you enabled debugging reproduce the issue so the error is captured in the log file. Once you reproduce the issue disable the debugging by setting both the WP_DEBUG and WP_DEBUG_LOG directives in the wp-config.php file to false.
Additional WordPress Debugging Options
Most probably we will never ask you to use these options, but it is good to know about them as well. Apart from the above mentioned options you can also use the following WordPress debugging options:
When this option and WordPress debugging are enabled WordPress will show the debug messages in the HTML pages as they are generated. If used on a live website this could lead to the disclosure of sensitive information about the website and server setup, so use cautiously. To enable this option add the below line to your wp-config.php file:
define( ‘WP_DEBUG_DISPLAY’, true );
define( ‘SCRIPT_DEBUG’, true );
Logging of WordPress Database Queries
In WordPress you can also keep a log of the WordPress database query in an array. This option comes in handy if you are experiencing WordPress database issues. To enable it add the following line to your WordPress wp-config.php file:
Once you enable this option all queries will be saved in the $wpdb->queries global.
Does Debugging Affect the Performance of My WordPress?
Yes, and some options (such as the logging of database queries) can have a very big impact on the performance of your website. Therefore unless it is a test or staging website, you should only enable debug when necessary and temporarily, to troubleshoot a specific issue.