Don’t know where to find WordPress logs after you began experiencing problems or want to prevent them from happening? That is a solid decision and a nifty way to investigate issues that may take your website down, ruin the user experience, and ultimately frustrate you for hours. WordPress stores a detailed log of things turning sour in a separate file, much like desktop, web, or mobile software you may encounter. The only concern is that logs may not have been enabled by default. Either way, we’re here to help you get to the bottom of this. Let’s demonstrate how to access your WordPress error logs.
Enable WordPress error logs functionality
Before you can check anything, you have to ensure the error log is turned on. Unfortunately, this means that if that isn’t the case already, you won’t have any details about difficulties that appeared beforehand. In contrast, you can be sure that any errors from that point forward will be documented. Plus, if you need to solve a recurring issue, as soon as it reappears, it’ll be noted. With all that said, to make this work, you must enable WordPress debugging this way:
- Gain access to your WordPress files using FTP (File Transfer Protocol).
- Find and open the folder titled root, www, public_html, or even domain-name.
- Open the configuration tile titled wp-config.php by right-clicking and selecting Edit.
- Go down to the last line that states /* That’s all, stop editing! Happy blogging. */ and paste these two lines of code below:
define( 'WP_DEBUG', true);
define( 'WP_DEBUG_LOG', true );
- Optional. You can also disable errors from appearing on the front-end of your website by adding this line below the other two:
define( 'WP_DEBUG_DISPLAY', false );
- Save the changes, and the WordPress debug mode will become active.
This only demonstrates one of several ways to troubleshoot problems with your website. Check our WordPress debug guide for other methods, some capable of dumping errors in the same log below. More importantly, you can turn error logging off by changing true in the first two lines to false. Moreover, you may erase both lines or all three before saving changes.
2. Instructions to access and review your WordPress error logs
Now that you turned on error logging or confirmed it was enabled, it’s time to open the log file. Once again, you can choose to:
- Use a cPanel on your web hosting provider’s website after logging in
- Access the files via FTP
Once you do so, look for the file titled debug.log inside the wp-content folder in the root (or however it was called for you) folder. Right-click on the file and select Edit again. After it opens, you’ll see a list of all logs that were captured by the debug tool. Many will repeat and some may be confusing. Luckily, they should have an identical or similar format: date, time, type of error, the reason for the error, and a related cause, such as an incorrectly placed character in a function. Finally, you can see the file path the error stems from.
Don’t be confused if the root is inside several other folders, especially if you’re using the shared or cloud web hosting type. Some errors may not follow this format at all, such as the “Stock trace” error with various lines underneath. You can proceed with solving the error yourself, reaching out to your hosting’s Customer Support, or hiring someone to help.
Two other error logs you may have to check
Are you interested in looking up some PHP errors? You can find a temporary PHP error log if so. It’s activated by default and unconnected to WP debugging above. Simply go “above” site root, i.e., one step back, to the folder that contains root. Some web hosting providers will forbid access, especially if you are on shared hosting. If you can do so, go to the tmp folder then open a file titled php-errors. Furthermore, many plugins have their logs. One notable example is WooCommerce, whose log you can find in “root/wp-content/wc-logs/”. Unlike the two above, each error will typically generate a separate file with the type of problem, date, and a random string of characters.
3. Check error logs for your website via the web hosting control panel (Situational)
Though the method above applies to all websites using WordPress version 2.3 and later, some web hosting providers also have developed independent, unaffiliated error logging functionality. This is helpful if you employ other CMS (Content Management Systems) or custom apps. Though we’re not affiliated, one example is Kinsta, hence we’ll use it to give you an idea of how it works and where to find the log. Like above, you need to double-check the feature is enabled or turn it on. To do so:
- Log in to the MyKinsta dashboard.
- Go to the Sites option in the left sidebar.
- Select Tools in the sidebar that appears on the right-hand side, then Enable under “WordPress debugging”.
Alternative. If you can’t find the option but are logged in, you can open the Kinsta WordPress Debug Tool directly.
At this point, it’s time to access and analyze your WordPress website error logs. Similar to the situation above, you have two options:
1. Use the MyKinsta dashboard
Go to Sites on the left-hand side and select the appropriate one. Then select Error Logs on the right-hand side. You’ll be taken to the Log viewer page. Select one of three files, error.log, access.log, or kinsta-cache-perf.log in the drop-down menu in the upper left corner. You can now view the last 1000 lines in the error. Moreover, you can use the search bar or use the slider in the top right corner to expand it up to 20,000 lines.
2. Get to the root folder via FTP
Only this time, head to the logs folder instead of wp-content. You’ll see lots of separate logs if the option is enabled. Those are old logs saved for safekeeping but with their size drastically reduced via GZ compression. The three files mentioned above are the most up-to-date versions and end with “.log”.