Logs can help you when you troubleshoot and debug issues on your WordPress sites. Checking your access and WordPress error logs is very simple. Just follow this tutorial.
Ways to View Access and WordPress Error Logs
There are few different ways to view your access and WordPress error logs as below:
View Raw Access and WordPress Error Logs Using FTP
You can view your logs by simply downloading the raw log files. First, connect to your site using SFTP. Then in the root, search for the folder called “logs”.
In this folder, you will see your access logs and WordPress error logs.
- access.log
- error.log
For older logs archives, Gzip (.gz) backups are automatically created. In order to see additional debugging information in WordPress, you can see the codex.
Enable Error Logs in wp-config.php File
WordPress error logs can also be seen by enabling your wp-config.php file. First, connect to your site using SFTP.
Then download your wp-config.php for editing it.
Note: Ensure that you have a backup of this file.
Search for the line that says /* That’s all, stop editing! Happy blogging. */ and just prior to it, add the below code:
define( 'WP_DEBUG', true );
In case the above code is already present in your wp-config.php file but is set to “false,” just change it to “true.” With this, the debug mode will get enabled.
Note: If warnings or error are present in your WordPress admin, you will see them.
Then enable the debug log so that all errors are sent to a file by adding the below code immediately after the WP_DEBUG line:
define( 'WP_DEBUG_LOG', true );
Save the changes and re-upload this to your server. Due to this, the errors will get logged to the debug.log file within your /wp-content/ folder. In case you don’t see this file for some reason, you can always create one.
In this way, you have learned to view access and WordPress error logs.