How to Check the Error Logs in WordPress

The first thing you can check when your WordPress site is experiencing a problem is the error logs. The problem is, WordPress doesn’t provide any log file at all by default. You can create a log file by modifying the “wp-config.php” file of WordPress. So, the main prerequisite to check the error logs in WordPress is that you need to have a privilege to both access and edit the WordPress files.

In WordPress, “wp-config.php” is a configuration file that saves some settings regarding your WordPress site, including database credentials to connect to the database. Other function of this file to generate an error log file of WordPress, but you need edit this file first to generate the error logs. Which part do you need to change?.

The part you are going to edit is define( 'WP_DEBUG', false ); which has the “false” value by default. To generate error logs, you need to change the value from “false” to “true”.

The “true” value will tell WordPress to run under the debug mode, which will log the errors in a file called “debug.log”. You can find the file of “debug.log” under the “wp-content” folder on WordPress. If you have changed the value but keep find no “debug.log” file, add the following code right below the define( 'WP_DEBUG', false );line.

define('WP_DEBUG_LOG', true );

Since WordPress will run in a debug mode, chances are you will find some error messages when accessing your site, especially on the dashboard. Everything is going to be normal again once you changed the the value of “true” back to “false”.

Following is example error logs of WordPress.

NOTE:

Since “wp-config.php” is the vital file in WordPress, you better make backup of it first before getting started to edit it to prevent worse accident from happening.

Related posts

Written by Al Putra

An open source user, Manchester United fan and CC0-licensed stuffs lover



Leave a Comment

Your email address will not be published. Required fields are marked *