{"id":3336,"date":"2023-12-21T07:30:35","date_gmt":"2023-12-21T07:30:35","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/how-to-enable-error-logs-in-magento-2\/"},"modified":"2025-05-09T17:17:59","modified_gmt":"2025-05-09T11:47:59","slug":"how-to-enable-error-logs-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/how-to-enable-error-logs-in-magento-2\/","title":{"rendered":"How to Enable Error Logs in Magento 2?"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Have you faced the frustration of encountering a blank white page, broken content, or 500 Internal server errors on your Magento platform? We understand these issues can be perplexing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Don\u2019t stress. We\u2019ve got you covered.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this blog, we\u2019ll discuss the steps on how to enable error logs in Magento 2.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is an Error Log in Magento 2?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Error log in Magento refers to a troubleshooting tool that stores error messages, notifications, and warnings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These logs play an important role in fixing and debugging by giving details of the issues that may affect the functionality of the Magento 2 platform.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Enable Error Logs in Magento 2?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">There are two ways to enable error logs in Magento 2. You can either do it from the <strong>admin dashboard<\/strong> or through <strong>the command line interface. <\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s learn both methods.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Method 1: Enable Magento 2 Error Logs from Admin Panel<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">From Magento 2.4.x onwards, the platform automatically generates error logs and stores them in the var\/log\/debug.log file. Therefore, you can access them directly if you\u2019re on the latest version.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And if you are using Magento 2.3.x or older versions, you need to manually enable error logs from the admin panel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here are the steps:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First and foremost, you need to log in to your Magento Admin Panel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1: Go to Stores &gt; Configuration.<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2023\/12\/Configure.png\" alt=\"Login and head configure \" class=\"wp-image-42239\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 2: Scroll to Advanced &gt; Developer &gt; Debug.<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2023\/12\/Developer-option.png\" alt=\"Choose the developer option\" class=\"wp-image-42241\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 3: Set \u201cLog to File\u201d to Yes and Save Configuration.<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2023\/12\/Debug.png\" alt=\"Set yes and save\" class=\"wp-image-42240\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The debug details will be logged to the var\/log\/debug.log file. Flush the cache once if needed. Please note that the enabling error log is not possible if the production mode is active.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Method 2: Enable Magento 2 Error Logs Using CLI Command<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>For Magento 2.3.1 or above:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command in the Magento directory to enable the error log: <code> bin\/magento setup:config:set --enable-debug-logging=true <\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And flush the cache by running the following command: <code> bin\/magento cache:flush <\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For versions older than Magento 2.3.1:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The above command doesn\u2019t work for Magento 2.3.1 and older versions. However, you can enable error reporting as follows:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code> enable: php bin\/magento config:set dev\/debug\/debug_logging 1 &amp;&amp;&nbsp; php bin\/magento cache:flush <\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Final Words<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Enabling the error logs in Magento 2 is an important step for effective troubleshooting. Whether you enable them through the Admin Panel or CLI commands, they help you to deliver a seamless experience.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I hope it is clear to you now how to enable error logs in Magento 2.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Explore the below resources to learn how to fix some other Magento 2 errors:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a title=\"How to Fix Magento 2 Homepage 404 Error\" href=\"https:\/\/meetanshi.com\/blog\/magento-2-homepage-404-error\/\" target=\"_blank\" rel=\"noopener\">How to Fix Magento 2 Homepage 404 Error<\/a><\/li>\n\n\n\n<li><a title=\"Solved: Class Zend Not Found in Magento 2 \u2013 Fix All Zend Errors\" href=\"https:\/\/meetanshi.com\/blog\/solved-class-zend-not-found-in-magento-2\/\" target=\"_blank\" rel=\"noopener\">Solved: Class Zend Not Found in Magento 2 \u2013 Fix All Zend Errors<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Have you faced the frustration of encountering a blank white page, broken content, or 500 Internal server errors on your Magento platform? We understand these&#8230;<\/p>\n","protected":false},"author":44,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-3336","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/3336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/44"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=3336"}],"version-history":[{"count":2,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/3336\/revisions"}],"predecessor-version":[{"id":13410,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/3336\/revisions\/13410"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=3336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=3336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=3336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}