Home > WooCommerce > Docs > Guide to Logging errors in WooCommerce

Guide to Logging errors in WooCommerce

Last updated: August 01, 2024
Written and researched by experts at AvadaLearn more about our methodology

By Sam Nguyen

CEO Avada Commerce

Nothing is perfect, and so is the WooCommerce store.

Therefore, acknowledging the errors in the online store is regarded as important as knowing the solution to improve their store.

Understanding that, a function is created in WooCommerce which enables merchants to see the list of errors in their WooCommerce store. It is logging errors.

To some people, especially the ones that have knowledge of coding, it is not a strange term. However, many merchants do not understand it clearly. So, let’s see what exactly the error log is as well as how to view it in the WooCommerce store.

What do you know about error logs?

Definition

Error logs is a technical term defining a record of critical errors which happen in an application, an operating system, and even a server when it is running. In many cases, error log is a helpful tool for developers to acknowledge the problems to fix it timely.

Possible places of PHP error logs

In fact, PHP error logs can be stored in multiple places, but there are 4 main ones that have the highest likelihood of PHP error logs on the server:

  • In the server’s roots folder
  • In public_html folder
  • In var/logs folder
  • In wp-content folder

The majority of PHP error logs will be saved in the name of error.log except for in the wp-content one. In this folder, it is called debug.log.

What do you know about fatal error logs?

Definition

To understand fatal error logs, the first thing you need to know is fatal error. In computer science, fatal errors (or fatal exception errors) are used to describe the kind of errors that can terminate the program with no warning and are unable to save its state. When facing fatal errors, users will lose all the unsaved information in the program, and it’s not easy to figure out the reasons for this error.

Structure of a PHP fatal error log

In fact, there are four elements in a PHP fatal error log, which are:

  • Timestamp (mark the time error occurred)
  • Error
  • File and line of the errors in the originated code
  • Stack trace (let developers know about the history of function calls and files that lead to errors)

How to see PHP fatal error logs in WooCommerce?

Step 1: Open Logs

In WooCommerce 3.2, users will be able to see the PHP fatal of your WooCommerce store easily in the PHP fatal errors. To open the fatal error log section in WooCommerce, you need to log in to your WordPress account and go to the dashboard. There, open WooCommerce and select Status. In Status, open Logs.

Open log

Step 2: View fatal error log

In Status, you will see a list of logs. Find the log named fatal-errors.log and select View to see the fatal error logs.

Howere, keep in mind that this log includes not only PHP fatal errors but also runtime errors and the ones that are triggered in the code by a PHP function on purpose.

How to find PHP error logs in WooCommerce?

Step 1: Create a phpinfo.php file

Open the dashboard in your WordPress account and go to Appearance. There, select Editor to access the roots of your WordPress’ directory and create a file name phpinfo.php.

Open Editor

Step 2: Insert the code

Open the file phpinfo.php you have just created in a text editor and insert this code into it:

<?php phpinfo(); ?>

Step 3: View the error logs

Access the file on your website.

NOTE: you can easily access this file by adding phpinfo.php after your site’ URL. For instance, if your URL is http://wordpressstore.com, you need to type http://wordpressstore.com/phpinfo.php to open the necessary file.

In the file of phpinfo.php, search for the value named error_log and you will see the PHP errors in your server. If it is empty, you are required to set a value to log errors, which is similar to this:

value of error log value

Final thoughts

In conclusion, it can be seen that an error log is a helpful tool for store owners to view the errors in their WooCommerce store. From this, they will rapidly know how to solve the problem and improve the site performance. Follow the guide above and you will find out the seeing WooCommerce error log is easy as pie.


Sam Nguyen is the CEO and founder of Avada Commerce, an e-commerce solution provider headquartered in Singapore. He is an expert on the Shopify e-commerce platform for online stores and retail point-of-sale systems. Sam loves talking about e-commerce and he aims to help over a million online businesses grow and thrive.

Stay in the know

Get special offers on the latest news from AVADA.