Est. reading time: 2 minutes
How to access WordPress error logs

How to access and view WordPress error logs

WordPress error logs are a valuable resource for troubleshooting any problems that might occur with your WordPress installation. They can help you identify the cause of an issue and provide information about what is happening in order to fix it.

In this article, we’ll show how to view errors from within WordPress in two different ways.


View raw WordPress error logs on your server

The first step towards viewing these log files is to make sure they exist. If you have access to your web hosting account or control panel, then check whether there is a folder called “error_logs”. To check this log in your cPanel (cPanel details are always provided by your provider) click File Manager > Log Files.

Once you know that the file exists, download the file on your computer and open it with an editor of choice such as Notepad++. The contents will be access logs and error logs from Apache. They can also contain information about PHP errors if you use phpMyAdmin etc.

Enable error logs in the wp-config.php file

The next option would be to enable error logging on the WordPress configuration of the wp-config.php file. This file contains all sorts of settings related to login credentials, database connection info, etc.

To access this file login into your cPanel account (if using cPanel) or SFTP client.

Locate file manager > public_html > wp-login.php, download the file to your computer for backup purposes.

Right-click on the file and click on edit. You should see a line that reads

/* That's all, stop editing! Happy publishing. */

above it add this

define( 'WP_DEBUG', true );

Most of the time you will find the code already exists but it is set to default value false so change it to true and save the file. Now you will find your access and error logs on a folder called wp-content > debug.log file

If you are unable to find this file, you can always create one yourself.

Note: if you enable the ( ‘WP_DEBUG’, true ); errors will be logged in debug.log and not on the error logs folder.

Related posts