October 17, 2024

Navigating Magento: A Guide to Seamless Logging Processes

NEKLO Team

Magento (Adobe Commerce)

Magento Logging: Short HOW-TO for Store Owners

NEKLO Team

Magento (Adobe Commerce)

Magento Logging: Short HOW-TO for Store Owners

Introduction

Magento is so complex that minor and major issues can come your way as to store administrator, as well as bother your customers. These problems are difficult to track and analyze if you are not a Magento specialist. In this short article, we will take the basics you need to know about error logging in Magento to pieces, including examining the right files and tracking problems efficiently.

What is Magento Log & Why You Need It

When there is something is wrong with your store, but you are not able to determine the reason on your own from the first sight, Magento error log is your number one troubleshooting tool to understand the roots of the problems and then solving them. What is more, not keeping an eye on the log files of your store can also lead to actual performance issues in your store. For example, huge log files can influence loading speed.

Log files are always getting bigger every time something happens in your store, and if you don’t clean them up from time to time, gigabytes of error log files are getting piled up on your server.  There might be certain problems that Magento is guilty of, and you have probably encountered or will encounter at least one of them. You can face:

  • Blank pages;
  • Pages that load partially;
  • Error screens;
  • Blocks missing from the pages;
  • Any other unexpected page behavior.

Basically, you can monitor errors in your Magento store, learn where they are coming from, and then take measures to fix them. When an error occurs, the responsible application writes its information into a log file and stores it for some time. If a page or something on it is missing, it is presumably the lack of memory and it is a web server log you should refer to. Magento system errors are noted accordingly in Magento logs.

The types of errors may vary and occur only in specific circumstances. It is one thing when the minor occurs on the backend, and totally another when only very few of your customers face troubles with their shopping experience with a specific product or order size. In this case, customers do not always report their issues to you and just leave, while you are left completely unaware of it. Without log tracking, you can miss information, that is vitally important for your store’s wellbeing.

How to Enable Logging for My Magento Store?

In Magento 2 logging is enabled by default. To enable logging in Magento 1, the setting you need is located under System > Configuration > Advanced > Developer > Log Settings. The files system.log and exception.log will be created under MAGENTO/var/log/ once any error occurs. PHP warnings and errors related to XML-files are stored in system.log. All other errors, which happened because Magento fails to find the right data to display a feature or load a page, are stored in exception.log. These files can be renamed for your convenience in the configuration settings.Log for all third-party extensions installed in your store is also kept in the var/log folder.

Dealing With Blank Pages

If a blank page happens, it probably has nothing to deal with Magento itself and the error took place in other applications, most likely by Apache/PHP. The blank page is usually a PHP fatal error. Therefore, you should check Apache logs for some clues. There is no permanent location for the ErrorLog file, but if it is there, you can always find it via command line by running phpinfo(). To make sure Apache creates logs, have log_errors enabled in the PHP settings, and error_reporting should be set to the corresponding error level.

Magento Error Reports

Sometimes Magento works as it is supposed to even if an error took place. In this instance, this error is most likely to be logged anyway. The possible location for this is the report folder. You can find it under MAGENTO/var/report.Is there are issues, this folder will contain files named by numbers. Each file includes the error message and a PHP trace. To know what happened, you need only the first line of the error message, while the rest of it might be useful for developers to detect the problem and fix it.

Conclusion

Important points to remember:

  1. Check Magento reports once in a while to make sure everything is doing great. If manual monitoring seems exhausting and gets forgotten among other administrative duties, you can use an automated solution, like the Log Monitoring extension by NEKLO. It will handle log checking for you and ensure timely email notifications about new log errors.
  2. For Magento 1 and Magento 2 exceptions are stored differently in logs and report folders. If you need to view other  Magento errors, they are in logs.
  3. Magento logs do not handle fatal errors, so don’t forget to pay attention to Apache logs.