Things might always go wrong: Magento is a complex application and when you run into problems, analysing these problems is difficult unless you know where to look. This tutorial helps you with inspecting the right logfiles to track problems down.
What can go wrong?
When dealing with third party Magento extensions, but also even the core, there might be errors in the PHP-code or unexpected configurations. There are many ways in which a problem can manifest itself:
- Blank pages
- Partially loaded pages with an abrupt ending
- Magento error-screen
- Blocks not showing up on the page
- Unexpected behaviour in general
Apache logs
When you encounter a blank page, chances are that something crashed before Magento even got the chance to deal with it. This means logging is most likely done by Magento, but (if configured correctly) by Apache/PHP. Your Apache server has defined an ErrorLog somewhere on the system-level and this ErrorLog might give interesting clues:
Whether Apache logs anything depends on various PHP settings: The PHP-setting log_errors should be enabled, while the PHP-setting error_reporting should allow for the right error-level.
Magento error reports
If Magento is still operational when an error occurs, chances are that Magento will log the error somewhere. One location is the report-folder:
MAGENTO/var/report
This folder might contain files with a numeric name (0123456789). If you open up such a file, you will notice some error-message plus a PHP trace of this error. While the first line with the error message is the most important part, sometimes developers will need the PHP trace as well to track down problems more easily.
Magento developer logs
Within the Magento configuration there is also the option to enable extra logging. When running into problems, this sometimes gives even more vital clues for troubleshooting problems. For instance, if a certain XML-file contains errors, Magento will ignore this file but report nothing about it. By enabling logging, exceptions like these will also be logged.
To enable logging, browse within the Magento Admin Panel to System > Configuration > Advanced > Developer > Log Settings and set the option Enabled to Yes. Once enabled, the following files will be created as soon as an error occurs:
MAGENTO/var/log/system.log
MAGENTO/var/log/exception.log
If the files are not there, it is because no error has occurred (yet).
About the author
Jisse Reitsma is the founder of Yireo, extension developer, developer trainer and 3x Magento Master. His passion is for technology and open source. And he loves talking as well.