How to use WordPress error logs?

Log files are one of the most important files on the server. There are two types of log files – access and error. These two files will be updated each time a web server or PHP throws an error or a visitor/bot accesses the page or site resource. Access logs show the URLs, links to images, URL status code, IP address of the bot/user, the time on which the resource/URL was requested, and more. Error logs, on the other hand, show the URL of the page or resource that has made the web server log the error or a programming-related issue that has been caused by a plugin or a theme.

Error Access log files

The error log is generated and updated by the web server or PHP. It has an error the user or a bot has encountered when it accessed a page or a resource of your website. For example, if your site doesn’t have a favicon and the bot accesses the favicon, the log would have traces of the “No such file or directory” error. This error would be appended to the log every time a new request is made to the file. The only way to get rid of it is to fix the favicon issue by uploading a new favicon.

The log files generated by PHP may have PHP related errors. Another way to find errors on WordPress is to set the WP Debug constant to true in the WordPress configuration (wp-config.php) file. Where is this file located? You can find the wp-config file in the WordPress installation directory. When you find this file, edit it with nano or vi editors and save it once you’ve made the change. What happens when you set WP Debug to true? The site will display warnings or errors generated by plugins, themes, etc. Setting the wp debug constant to true to the best way to find WP errors.

Where can you find the logs on the server? You can find them using the command find / -name access*.log or find / -name error*.log on the Linux server. These two Linux commands will list all files the find utility finds on your server. Once you find the file, use the command cat fn_name, tail -N fn_name to see the file’s content. In these two commands, fn_name is the name of the log, and N is the number of lines. If you’re using a shared hosting plan, you can see the log data with the cPanel tool.

What should you do with the errors? If you think the application shouldn’t be throwing errors for certain requests, you must fix the issue immediately or share the screenshot of the same with the developer of the plugin/theme that is responsible for it.

What happens if you ignore the errors? If you don’t check the log data, you may never find the reason why your site had crashed, not responding, is showing blank pages, and more.


Pramod is the founder of wptls. He has been using WordPress for more than nine years. He builds web applications, and writes about his experiences with various WP products on this site.

Leave a Reply

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