WordPress logging explained: Using a WordPress error log correctly

With WordPress logs for logged errors, you can rectify errors and find their source quickly. To do this, simply activate the WordPress error log via the wp-config.php. file or use a special error log plugin.

What is a WordPress error log?

For all services that run via the server on a WordPress page there are WordPress logs that log the ongoing activities. WordPress error logs are particularly interesting and important. They can be used to log and save errors that occur on webpages, in scripts or in services like plugins. This makes it easy for you to quickly find the causes of errors and rectify common ones like the dreaded white screen of death in WordPress.

Tip

With WordPress hosting from IONOS, you can create a modern, secure, and appealing WordPress website – 3 free domains included.

How does WordPress error logging work?

In order to use WordPress error logs, the error logging has to be activated first. You can do this either via an error monitoring plugin or via the wp-config.php file. This configuration file plays an important role when it comes to your WordPress settings and it regulates how a website connects to the WordPress database on which security keys and table prefixes are used, amongst other things. You can also activate the error logging in the PHP file.

Once error logging has been activated, your WordPress system automatically creates and saves PHP error logs. The difference between this and the WordPress debug mode is that during the debugging process, the errors and warnings are displayed to an administrator directly. However, in order to save error logs for later access, WordPress error logs must be set up. If an error appears when the error log is activated, simply look for the corresponding debug.log file in the root directory /wp-content/. This shows all errors, warnings, and notices which can also be viewed, downloaded, and edited.

Using WordPress logs for error logging

Manual check

Proceed as follows to manually set up and review error logging.

Step 1: Connect to the admin dashboard through the SFTP or FTP client or another file manager app with the web server.

Step 2: Access the root or master directory of your website and then find the wp-config.php file. Create a backup of the original file first and then open the file with a text editor.

Step 3: Search for the following line in the downloaded PHP file: That’s all, stop editing! Happy blogging.

Step 4: Insert the following debug code above the line mentioned above to activate WordPress debug mode:

define( 'WP_DEBUG', true );

If the code already contains the value false in the file, change the value to true to activate debug mode.

Step 5: Now add a supplementary code component to also activate the WordPress error log. Insert the following command directly underneath the debug code:

define( 'WP_DEBUG_LOG', true );

Step 6: Save all changes and upload the file to the master directory.

Step 7: To access and check saved error logs from the master directory, connect to the web server and go to the /wp-content/ folder. Here you will find the debug.log file with all logged error messages.

Plugins for error logging

To open saved error logs directly in the admin dashboard and to display and record errors, there are special WordPress plugins that you can use for error monitoring. For this, first you need to active your WordPress log for error logging. Alternatively, you can usually also install and activate the corresponding plugin so that you can log errors automatically.

Error log plugins have a variety of different functions, including:

  • Dashboard widgets that display current error messages from the PHP error log (number of logs optional)
  • Email notifications about the most recent error messages and warnings
  • Automatic referencing of error sources in the error log
  • Recording of ping errors

The following WordPress error log plugins are available:

We use cookies on our website to provide you with the best possible user experience. By continuing to use our website or services, you agree to their use. More Information.