Do you need to access your WordPress error logs to troubleshoot a problem on your site?
WordPress comes with a debugging system that can log any error messages displayed on your site. This can help you discover and fix problems on your website.
In this article, we will show you how to find and access your WordPress error logs.
Expert Tip: Tired of fixing errors on your website and other maintenance tasks? WPBeginner Maintenance Services can help! We’ll take care of updates, uptime monitoring, and security monitoring so that you can focus on growing your business.
How and When Can WordPress Error Logs Help?
Are you having problems with your WordPress website? Checking your WordPress error logs can help you find the source of the issues, such as slow website performance, plugins that aren’t working properly, and website crashes.
What Is an Error Log?
An error log is a list of error messages generated by your website and the dates and times they occurred. Once WordPress debug mode is turned on, these messages are collected in a file so that you can review them later.
Your WordPress error log is a troubleshooting tool that can help you identify plugins, themes, or code that are causing problems. You can then go ahead and find a fix for those WordPress errors.
For example, checking the error logs can help troubleshoot errors like:
- The WordPress white screen of death
- PHP errors
- The invalid JSON error
- “Sorry, you are not allowed to access this page” error
- Many other common WordPress errors
That being said, let’s look at how to find and access your WordPress error logs.
The first step is to enable WordPress debug mode, which you can do using either a plugin or code:
Enabling WordPress Debug Mode With a Plugin
WordPress debugging is turned off by default, so WordPress will not log any errors. If you can still log in to your WordPress site, you can enable debug mode using a plugin.
The first thing you need to do is install the WP Debugging plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.
Upon activation, the plugin automatically activates WordPress debug mode, and error messages on your site will now be logged.
Enabling WordPress Debug Mode Using Code
You can also turn on WordPress debug mode using code. This method is suitable for more advanced users or if you can’t log in to your WordPress admin area.
You will need to edit your wp-config.php file using an FTP client or the file manager option in the cPanel of your WordPress hosting control panel.
Once you have the file open, simply find the text where it says, ‘That’s all, stop editing! Happy blogging.’
Just before this line, go ahead and add the following code:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
For step-by-step instructions, you can see our guide on how to set up WordPress error logs in wp-config with code.
How to Find and Access WordPress Error Logs
Now that you have enabled WordPress debug mode, any future error messages on your website will be stored in the WordPress error logs.
That means that your logs will be empty at first. You will need to try to recreate the problem on your site so that the error messages can be saved to the log file.
For example, you should revisit any posts or pages that are causing an error.
Next, you must connect to your website using an SFTP/FTP client like FileZilla or the file manager option in your WordPress hosting control panel. If you haven’t used FTP before, then you may want to see our guide on how to use FTP to upload files to WordPress.
Once you are connected to your site, navigate to the /wp-content/
folder. Inside the folder, you will find a file called debug.log
. The debug.log
file contains every WordPress error message, warning, and notice that has been logged.
To see the contents of this file, you will need to download, view, or edit it.
You can then inspect the error messages along with the date and time they occurred. This information can help you find a solution to the problems you are encountering on your WordPress website.
How to Fix Issues Found in WordPress Error Logs
Once you have accessed your WordPress logs, you can find the error message that was logged when the problem on your website happened. Remember that the times displayed are UTC, not your local time.
While most users won’t understand the error messages, they are a good place to start troubleshooting. Once you note the error message and code, you may find a solution to your problem in our guide on the most common types of errors in WordPress and how to fix them.
If you can’t find the solution on your own, then you can reach out for help on our free WPBeginner Engage Facebook Group, where you can get support from our WordPress experts and over 98,000 users. Just make sure to quote the error code or message you found in the WordPress error log file.
Other places you can turn for help are the official WordPress forums, your WordPress web hosting company’s support team, or the designated support area for the plugin or theme you are having trouble with.
When asking for support, we recommend reading our guide on how to properly ask for WordPress support and get it to learn the right way to ask questions and the best places to find help.
Disabling WordPress Debug Mode
Once you have fixed the issue on your WordPress site, we recommend disabling debug mode. Leaving it on may slow down your website and potentially leak unwanted information, which is a WordPress security risk.
If you enabled debug mode with a plugin, then simply navigate to Plugins » Installed Plugins and deactivate the WP Debugging plugin.
If you enabled debug mode with code, then simply edit the wp-config
file as you did before.
You will need to change the WP_DEBUG
and WP_DEBUG_LOG
lines of code to ‘false’.
We hope this tutorial helped you learn how to find and access your WordPress error logs. You may also want to learn how to fix WordPress posts returning 404 errors or see our expert pick of the best WordPress error page design examples.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Olaf
A PHP error log isn’t always available on a website, and finding errors blindly can be quite challenging, especially if PHP error display is disabled and the site occasionally falls into the white screen of death. Debug mode and the debug log are perfect tools for solving these issues. Having access to the error log can sometimes save an entire evening of blindly searching for issues, like a simple plugin conflict. It’s an essential tool for troubleshooting errors on a website.
Syed Zulqadar Hassan
Thank you. It helped me find my problem.
WPBeginner Support
You’re welcome, glad our guide could help you find the issue on your site
Admin
Jiří Vaněk
I wasn’t sure if I should keep the debug log on permanently so that I can track back errors that were happening on the site but you basically told me that it’s not a good practice if nothing major is happening on the site. Thank you. So I will leave the debug log turned off and use it only in case of an error that I will solve at that moment.
Dayo Olobayo
You’re right. Debug mode can slow down your website a bit especially with high traffic. Turning it off when not actively troubleshooting helps keep your site performing at its best. For long-term error tracking, there are plugins that can log errors without the performance hit of full debug mode.
alex partagas
Always a great site to go-to. Thanks!
WPBeginner Support
You’re welcome!
Admin
Kris
Ok. Usefull. Thank you.
WPBeginner Support
You’re welcome, glad our guide was helpful!
Admin