How to Enable Magento Error Log
It is frustrating when errors don’t leave your code 😰
Even more, you don’t know what is going wrong and where!
Been there?
Me too.
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
- Save
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:
1 |
php bin/magento config:set dev/debug/debug_logging |
Keep your logs empty, your Magento site healthy, and customers happy! 😃
Thank You.
Also Read:
How to Throw Exception on Magento 2 Admin Save Configuration
How to Enable Error Logs in Magento 2?
Sanjay Jethva
Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe.
His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.
4 Comments
Very informative blog. Thank you for helping.
Hello Danial,
We’re glad that the solution is helpful for you.
Thank You
Thank you for sharing the process for Magento 1.x. However, it would be great if you can also include the method for Magento 2.x.
Thank you.
Also, to enable error log in Magento 2, you only need to run a single command which is already mentioned in the blog.