Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

A Complete Guide To Magento Error Logs

If you have ever used Magento you must have been in a situation where something on your store is not working and you are not sure what could be the problem.

Magento Error logs are extremely helpful in these situations. They help you quickly find details about any issue and also help with basic troubleshooting.

That’s why it’s important to be familiar with Magento Error Logs. This article will provide you with a complete guide to Magento error logs, so you can stay on top of any issues that arise on your store.

You’ll learn about what Magento error logs are, how to access them, and how to interpret them.

With this guide, you will be able to understand your Magento error logs and take the necessary steps to keep your store running smoothly. So let’s get started!

What Are Magento Error Logs

Before we fully understand what Magento error logs are lets first understand the process which generates them in the first place.

Whenever a user creates a requests on your Magento store it is first handled by the server (Apache/ Ngnix) which is then passed on to Magento. Magento then sends the query to the MySQL database. 

Errors can come up on any step of this process. This is why Magento loggers keep a record of all these activities. The logs with errors are called error logs. 

Essentially Magento error logs are log files that are generated by the Magento platform to record errors, warnings, and other information that can be used to troubleshoot issues with the website.

These logs can include information such as PHP errors, database errors, system errors, and exceptions that occur within the Magento system.

The logs can be used to identify any issues that may be causing the website to malfunction.

How To Enable Magento Error Logs 

In Magento 2 error logs are enabled by default and you don’t have to tweak anything to enable them.

Where To Find Magento Error Logs

The Magento logs can be found in var/log/ folder and can be accessed via CLI or through FTP.

To access the error logs via the Command Line Interface, us the following command to access the logger folder:

cd public_html/var/log

Once in the folder use the following line to view the log file:

ls -l 

Understanding The Error Log Structure

Once you open the log file might get confused if you are looking at it for the first time. The log file has several lines, but all of them essentially have a same structure. Let’s understand its structure. The error log has 5 parts:

  • Date time stamp
  • Error Level (e.g. Warning, Critical, Error, etc.)
  • Error Description
  • Affected file
  • Line number (in the affected file) where error is generated

Let’s look at an example to better understand this:

[2023-01-11T09:58:06.506071+00:00] report.ERROR: Cron Job bshop_sync_order has an error: Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user ‘magento_staging’., SQL state 28000 in SQLConnect in /var/www/vhosts/magentotesting.bshop.com.hk/app/code/Cgo/Integration/Cron/SyncOrder.php on line 1159. 

Here

  • Date time stamp-  [2023-01-11T09:58:06.506071+00:00]
  • Error Level- report.ERROR
  • Error Description-  Cron Job bshop_sync_order has an error: Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user ‘magento_staging’., SQL state 28000 in SQLConnect in
  • Affected file- /var/www/vhosts/magentotesting.bshop.com.hk/app/code/Cgo/Integration/Cron/SyncOrder.php 
  • Line number (in the affected file) where error is generated- line 1159. 

Get Notifications When Errors Occour

Now that you know what Magento error logs are and how to access them its time to set up a system to get notified whenever an error is logged.

Unfortunately Magento doesn’t notify you automatically when error logs are generated and you need to manually retrieve them.

However if you want to get notified when error logs are generated you can set up a cron job that’ll send you a message everytime an error log is generated. 

Conclusion

In conclusion, Magento error logs are an invaluable tool for any Magento store owner. They provide detailed information about any errors that may have occurred in the store and allow you to quickly troubleshoot and fix such issues. By understanding Magento error logs, you can greatly reduce the time it takes to resolve problems and improve the overall performance of your store.



This post first appeared on Magento 2 Ecommerce, please read the originial post: here

Share the post

A Complete Guide To Magento Error Logs

×

Subscribe to Magento 2 Ecommerce

Get updates delivered right to your inbox!

Thank you for your subscription

×