How to Access PHP Error Logs in WordPress

Having a code problem with your WordPress site?

There's a significant chance that the answer can be found in a PHP error log.

Often these error logs are available via hosting company control panels, but also there are many users who can't access them. In this guide, I'll show you how to set up PHP error logs for your WordPress site. We recommend the Logtivity platform as this requires very little configuration and it also makes your error logs very easy to read.


Set up access for your WordPress error logs

You will need to create an account at Logtivity to follow along with this guide. There is a 10-day free trial you can use to test the service. This guide shows how to connect your site to Logtivity.

This screenshot below is a preview of error logs in Logtivity. You can see the errors, how often they occur, and when they last occurred. Click here for an explanation of the difference between errors and warnings.

Error logs in Logtivity

For each PHP error, you can to drill down and see specific details. Logtivity can point you to the file that’s causing problems and give you a stack trace. This screenshot below shows an error from WooCommerce and specifically the WooCommerce Subscriptions plugin. In this error report you can see exactly which line of code in which file is causing the problem. This issue is caused by line #435 in class-wcs-cart-renewal.php.

Error logs in WordPress and Logtivity

There’s also a full stack trace available so you can track errors back through your codebase. This screenshot below shows the stack trace for the WooCommerce error above.

Error logs stack trace in WordPress

Why we recommend Logtivity's hosted error logs

Hosted error logs have several major advantages over regular error logs from your hosting company:

First, Logtivity error logs are easily and instantly searchable. With many hosting companies, the error logs are dumped into one big, messy file.

Second, you get instant access to logs: Hosting companies often make it difficult to view error logs for WordPress sites. Some hosting companies even require you to contact them to get log access! With Logtivity, you’ll always have instant access to error logs.

Third, you receive notifications: Logtivity notifies you as soon as an error occurs, so can jump in and find the solution as soon as possible. A Fatal Error is an error that takes your WordPress site offline. Logtivity will catch these errors and send you an immediate notification by Slack and Email. This image below shows a Slack notification for a Fatal Error. You can click the “View Error” button to immediately see full details on what’s wrong:

Finally, you can organize the error logs. With Logtivity you can see which errors have been resolved, and which ones still require work from your team. The hosted error logs allow you to mark each issue as “Resolved” or “Unresolved”. There is a filter at the top of the screen so you can see which errors have been fixed, and which ones still need a solution. This helps you keep track of which errors still need your team’s attention.

  • Steve Burge

    Steve is the founder of PublishPress. He's been working with open source software for over 20 years. Originally from the UK, he now lives in Sarasota in the USA. This profile is generated by the PublishPress Authors plugin.

    View all posts

Leave a Reply

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