It is frustrating when errors don’t leave your code 😰
Even more, you don’t know what is going wrong and where!
The Magento, by default, does not keep a track of errors and exceptions. However, you can always enable Magento error log to debug the issues. It is a way to tell Magento to save the error logs, which can be later used to audit and solve the errors!
Method to Enable Magento Error Log:
- Log in to admin panel
- Navigate to System > Configuration > Advanced > Developer
- Enable the option of Log Settings
Note: Grant the full permission, i.e., 777 to the folder /var/log where log files are stored.
How to Find the Magento Error Log File:
Now that you know how to enable Magento error log file, learn how to find that file too!
The log files are located in the <magento-folder>/var/log/ folder.
If you do not find the log files here, check if the folder is given the writing permission. If not, the web servers won’t be able to create the log files.
The primary files are system.log with all PHP warnings and issues with XML files and exception.log with all the exceptional cases when Magento fails to handle data for any reason.
That’s all about the Magento error logs you need to know.
However, a few key takeaways. Make sure the errors are hidden in the production mode. Do check the Apache logs as well.
If you are a Magento 2 store owner, the entire process becomes easy for you! Just run a single command:
php bin/magento config:set dev/debug/debug_logging
Keep your logs empty, your Magento site healthy, and customers happy! 😃