{"id":2511,"date":"2025-05-27T18:27:03","date_gmt":"2025-05-27T15:27:03","guid":{"rendered":"https:\/\/plumrocket.com\/learn\/?p=2511"},"modified":"2025-06-09T10:34:21","modified_gmt":"2025-06-09T07:34:21","slug":"how-to-enable-error-logging-in-magento-2-and-get-email-notifications-automatically","status":"publish","type":"post","link":"https:\/\/plumrocket.com\/learn\/magento-error-logging","title":{"rendered":"How to Enable Error Logging in Magento 2 and Get Email Notifications Automatically"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full disable_zoom\"><img loading=\"lazy\" width=\"1600\" height=\"600\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2025\/05\/magento-logging-2-1.png\" alt=\"\" class=\"wp-image-2541\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2025\/05\/magento-logging-2-1.png 1600w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2025\/05\/magento-logging-2-1-300x113.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2025\/05\/magento-logging-2-1-1024x384.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2025\/05\/magento-logging-2-1-768x288.png 768w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2025\/05\/magento-logging-2-1-1536x576.png 1536w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2025\/05\/magento-logging-2-1-1568x588.png 1568w\" sizes=\"(max-width: 1600px) 100vw, 1600px\" \/><\/figure>\n\n\n\n<p>Magento 2 is a powerful ecommerce platform, but like any complex system, it can encounter errors. If left unchecked, these errors can silently affect store performance, hurt sales, or cause full outages \u2014 all without you knowing. This guide shows you how to enable logging \u2014 including the Magento 2 exception log, system log, and debug log \u2014 display errors during development, and introduces a powerful solution: real-time admin email alerts.<\/p>\n\n\n\n<p><p style=\"background-color: #f9fdff;min-height:100px;box-shadow: 0 3px 10px 0 rgba(0,0,0,.15); padding: 20px 20px;\">Don\u2019t just log errors \u2014 stay ahead of them. Add the <a href=\"\/magento-admin-email-notifications\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 Error Notification Extension<\/a> to get instant alerts and keep your store running smoothly.<\/p><\/p>\n\n\n\n<h2>Why You Should Monitor Magento 2 Errors Proactively<\/h2>\n\n\n\n<p>Proactive monitoring of Magento 2 errors is essential for maintaining a high-performing, secure, and reliable ecommerce store. Here are the key reasons to implement proactive error monitoring:<\/p>\n\n\n\n<h3>Impact of Silent Failures on Sales and Performance<\/h3>\n\n\n\n<p>Silent failures, characterized by the absence of visible warnings or error messages, can severely impact a store&#8217;s performance and sales. These elusive issues include critical problems such as product changes not saving without any indication in the admin panel or logs, and backend issues going unnoticed until reported by customers or staff, leading to significant, unaddressed disruptions.<\/p>\n\n\n\n<p><strong>Why they matter:<\/strong><\/p>\n\n\n\n<ul><li>Missed Sales: Products may not appear on the site, hurting inventory visibility and sales.<\/li><li>Performance Issues: Unchecked errors and large log files can slow down your store by up to 20%.<\/li><li>Poor Customer Experience: Customers may face missing products, failed checkouts, or broken pages \u2014 leading to lost trust and revenue.<\/li><li>Higher Downtime Risk: If left unresolved, silent failures can lead to full outages or system crashes that stop sales entirely.<\/li><\/ul>\n\n\n\n<h3>Magento\u2019s Default Error Logging (and Its Limits)<\/h3>\n\n\n\n<p>Magento includes a built-in logging system that helps developers and merchants understand and debug store behavior.<\/p>\n\n\n\n<p><strong>Magento Log File Location:<br><\/strong> Logs are stored in the <code>\/var\/log\/<\/code> directory:<\/p>\n\n\n\n<ul class=\"has-dark-gray-color has-text-color\"><li><span style=\"color:#07a300\" class=\"has-inline-color\">system.log:<\/span> General system messages and errors<\/li><li><span style=\"color:#07a300\" class=\"has-inline-color\">exception.log<\/span>: Uncaught exceptions in the application<\/li><li><span style=\"color:#07a300\" class=\"has-inline-color\">debug.log<\/span>: Detailed debug info (only in developer mode)<\/li><\/ul>\n\n\n\n<p><strong>Developer vs. Production Mode:<\/strong><\/p>\n\n\n\n<p>Developer mode: Verbose logging with detailed error messages, helpful for debugging.<\/p>\n\n\n\n<p>Production mode: Minimal error detail is shown to users, and only basic errors are logged to protect performance and security.<\/p>\n\n\n\n<p><strong>Limitations of Magento Logging:<\/strong><\/p>\n\n\n\n<ul><li>No Alerts: Magento doesn\u2019t notify you when errors occur \u2014 logs must be checked manually.<\/li><li>Manual Review: Searching large log files can be slow and tedious.<\/li><li>Delayed Discovery: Issues can go unnoticed for long periods unless logs are actively monitored.<\/li><li>No Log Rotation: Magento doesn\u2019t rotate logs by default, so files can grow indefinitely unless managed manually or by server tools \u2014 potentially impacting performance.<\/li><\/ul>\n\n\n\n<h2>How to Enable Logging in Magento 2<\/h2>\n\n\n\n<p>Proper logging is crucial for diagnosing and resolving issues. Whether you&#8217;re troubleshooting problems in development or monitoring a live store, enabling logging helps you track system behavior, exceptions, and debug information.<\/p>\n\n\n\n<h3>Enabling Magento 2 Exception and System Logs via Admin\u00a0<\/h3>\n\n\n\n<div class=\"wp-block-group pr-notice pr-notice-info\"><div class=\"wp-block-group__inner-container\">\n<p class=\"pr-notice-title\" style=\"margin-bottom: 25px;\">To enable system.log and exception.log through the Magento Admin Panel:<\/p>\n\n\n\n<ol><li>Log in to your Magento Admin Panel.<\/li><li>Navigate to <strong>Stores &gt; Configuration &gt; Advanced &gt; Developer &gt; Debug<\/strong>.<\/li><li>Set <strong>Log to File<\/strong> to <em>Yes<\/em>.<\/li><li>Save the configuration.<\/li><li>If needed, flush the cache to apply changes.<\/li><\/ol>\n\n\n\n<p><\/p>\n<\/div><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"1207\" height=\"548\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2025\/05\/magento-logging-1-1.png\" alt=\"How to enable system.log and exception.log through the Magento Admin Panel\" class=\"wp-image-2512\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2025\/05\/magento-logging-1-1.png 1207w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2025\/05\/magento-logging-1-1-300x136.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2025\/05\/magento-logging-1-1-1024x465.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2025\/05\/magento-logging-1-1-768x349.png 768w\" sizes=\"(max-width: 1207px) 100vw, 1207px\" \/><\/figure>\n\n\n\n<div class=\"wp-block-group pr-notice pr-notice-warning\"><div class=\"wp-block-group__inner-container\">\n<p class=\"pr-notice-title\">Important Information:<\/p>\n\n\n\n<p>In Magento 2.4.x and above, error logs are generated by default and stored in <code>var\/log\/debug.log<\/code>. For versions 2.3.x and below, you must enable logging in Magento manually as described above.<br><br>Also, if you need to display errors in Magento 2 directly on the frontend for debugging, make sure you\u2019re in developer mode. The platform hides most errors in production to protect security<\/p>\n<\/div><\/div>\n\n\n\n<h3>How to Enable Debug Log in Magento 2 via CLI<\/h3>\n\n\n\n<p>Using the CLI is the most reliable way to enable logging in Magento 2, especially in production environments or automated deployment pipelines.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div class=\"prism-title\">For Magento 2.3.1 and above:<\/div><pre><code class=\"language-php\">bin\/magento setup:config:set --enable-debug-logging=true\nbin\/magento cache:flush\n<\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div class=\"prism-title\">For older versions:<\/div><pre><code class=\"language-php\">php bin\/magento config:set dev\/debug\/debug_logging 1\nphp bin\/magento cache:flush\n<\/code><\/pre><\/div>\n\n\n\n<p>These commands enable debug logging (<span style=\"color:#07a300\" class=\"has-inline-color\">debug.log<\/span>) and flush the cache to apply the settings. It complements the system.log and exception.log in Magento 2, providing deeper insights for developers.<\/p>\n\n\n\n<h3>Where is the Magento 2 Log Location<\/h3>\n\n\n\n<p>After enabling logging, log files are stored in the Magento root directory under: <code>\/var\/log\/<\/code><\/p>\n\n\n\n<p><strong>How to View Logs in Magento 2:<\/strong><\/p>\n\n\n\n<ul><li>Via FTP\/SSH: Connect to your server and navigate to <code>\/var\/log\/<\/code>. Open or download the relevant log files.<\/li><li>Via Command Line:&nbsp;<\/li><\/ul>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">tail -f \/path\/to\/magento2\/var\/log\/system.log\ncat \/path\/to\/magento2\/var\/log\/exception.log<\/code><\/pre><\/div>\n\n\n\n<p>This lets you view real-time log updates or inspect past issues.<\/p>\n\n\n\n<h3>Interpreting Common Log Entries<\/h3>\n\n\n\n<p>Magento 2 uses different log files to help you understand what&#8217;s going wrong or how the system is behaving. Here&#8217;s what each one does:<\/p>\n\n\n\n<div class=\"wp-block-cover has-background-dim\" style=\"background-color:#fbfdff;min-height:100px\"><div class=\"wp-block-cover__inner-container\">\n<ul class=\"has-dark-gray-color has-text-color\" style=\"margin-top: 0px; margin-bottom: 7px\"><li><strong>exception.log<br><\/strong> This file shows serious errors that stop Magento from working properly \u2014 like something crashing behind the scenes. You\u2019ll see the time it happened, the type of error, where in the code it happened, and what went wrong.<br><br><\/li><li><strong>system.log<br><\/strong> This file tracks a wider range of issues \u2014 not just crashes. It includes warnings, notices, and general errors. Each entry tells you when it happened, how serious it is (like WARNING or CRITICAL), and what the problem was.<br><br><\/li><li><strong>debug.log<\/strong><br>This is mainly for developers. It shows detailed info like which database queries were run, what events Magento triggered, and the values of certain variables. It helps track exactly what Magento was doing at a certain time.<\/li><\/ul>\n<\/div><\/div>\n\n\n\n<p><strong>Example Log Entry:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">[2025-05-22 10:15:30] main.CRITICAL: Exception: Unable to save product in \/var\/www\/html\/vendor\/magento\/module-catalog\/Model\/ProductRepository.php:123<\/code><\/pre><\/div>\n\n\n\n<ul><li><strong>Timestamp:<\/strong> [2025-05-22 10:15:30]<\/li><li><strong>Log Level:<\/strong> main.CRITICAL<\/li><li><strong>Description:<\/strong> Exception: Unable to save product<\/li><li><strong>File &amp; Line:<\/strong> \/var\/www\/html\/vendor\/magento\/module-catalog\/Model\/ProductRepository.php:123<\/li><\/ul>\n\n\n\n<h3>To summarize:<\/h3>\n\n\n\n<ul><li>Use the Admin Panel to enable logging in Magento 2 if you&#8217;re on version 2.3.x or in developer mode.<\/li><li>Use CLI commands for scripting, automation, and production environments.<\/li><li>Regularly monitor <code>\/var\/log\/<\/code> for <span style=\"color:#07a300\" class=\"has-inline-color\">system.log<\/span>, <span style=\"color:#07a300\" class=\"has-inline-color\">exception.log<\/span>, and&nbsp;<\/li><li><span style=\"color:#07a300\" class=\"has-inline-color\">debug.log<\/span> to catch issues early.<\/li><li>Combine log review with stack trace analysis to pinpoint root causes efficiently.<\/li><\/ul>\n\n\n\n<p>By taking the time to Magento enable logging correctly, you gain powerful visibility into your system&#8217;s inner workings\u2014essential for maintaining a healthy, high-performing store.<\/p>\n\n\n\n<h2>How to Get Automatic Admin Email Notifications in Magento 2<\/h2>\n\n\n\n<p>Enabling logging in Magento 2 is just the start. But manually checking Magento <span style=\"color:#07a300\" class=\"has-inline-color\">system.log<\/span>, <span style=\"color:#07a300\" class=\"has-inline-color\">exception.log<\/span>, or <span style=\"color:#07a300\" class=\"has-inline-color\">debug.log<\/span> can be tedious \u2014 and risky if critical issues go unnoticed. That\u2019s where the<a href=\"\/magento-admin-email-notifications\" target=\"_blank\" rel=\"noreferrer noopener\"> Magento 2 Admin Email Notifications Extension<\/a> comes in \u2014 a powerful tool that turns passive logs into actionable alerts.<\/p>\n\n\n\n<p>Here\u2019s what the default Magento logging is missing \u2014 and how the extension solves it:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Feature<\/strong><\/td><td><strong>Magento Logging<\/strong><\/td><td><strong>With Email Notifications Extension<\/strong><\/td><\/tr><tr><td>Email alerts<\/td><td>\u274c None<\/td><td>\u2705 Real-time notifications<\/td><\/tr><tr><td>View logs in admin<\/td><td>\u274c FTP\/SSH required<\/td><td>\u2705 Admin panel log viewe<\/td><\/tr><tr><td>Custom filtering<\/td><td>\u274c Not supported<\/td><td>\u2705 By type, date, file, message<\/td><\/tr><tr><td>Notification frequency<\/td><td>\u274c None<\/td><td>\u2705 Every 30 mins, hour, or day<\/td><\/tr><tr><td>Multiple email recipients<\/td><td>\u274c No<\/td><td>\u2705 Yes<\/td><\/tr><tr><td>Log cleanup<\/td><td>\u274c Manual<\/td><td><br>\u2705 Auto-deletion rules<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>This extension complements your existing log setup \u2014 whether you Magento 2 enable logging via the Admin Panel or CLI. It helps solve the biggest limitation of Magento\u2019s native logging: lack of real-time visibility and alerts.<\/p>\n\n\n\n<p>Combined with native logs (<span style=\"color:#07a300\" class=\"has-inline-color\">system.log<\/span>, <span style=\"color:#07a300\" class=\"has-inline-color\">exception.log<\/span>, and <span style=\"color:#07a300\" class=\"has-inline-color\">debug.log<\/span>), this extension turns Magento error reporting into an intelligent, proactive system that:<\/p>\n\n\n\n<ul><li>Detects and notifies you of problems as they happen<\/li><li>Provides immediate access to logs within the admin panel<\/li><li>Prevents silent failures that could impact sales or customer experience<\/li><\/ul>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u201cAn essential extension for Magento stores. It keeps me up-to-date on every issue, and the filtering and scheduling features are incredibly helpful for organizing my workflow. Highly recommend this extension!\u201d<\/p><cite>\u2014 Tyrell Levy, Plumrocket customer<\/cite><\/blockquote>\n\n\n\n<div class=\"wp-block-cover has-background-dim\" style=\"background-color:#f0f9ff;min-height:10px\"><div class=\"wp-block-cover__inner-container\">\n<p class=\"has-text-align-center has-dark-gray-color has-text-color\" style=\"font-size:25px\"><strong>Don\u2019t Let Critical Errors Go Unnoticed!<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center has-dark-gray-color has-text-color\">Install the Magento 2 Email Notifications Extension and turn passive logging into a real-time warning system that protects your store \u2014 and your revenue.<\/p>\n\n\n\n<p class=\"has-text-align-center has-dark-gray-color has-text-color\">\u2705 Reasonable Price<br>\u2705 60-day money-back guarantee<br>\u2705 No subscriptions<br>\u2705 1 year of support &amp; free updates<\/p>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-background\" href=\"\/magento-admin-email-notifications\" style=\"border-radius:30px;background-color:#1b5783\" target=\"_blank\" rel=\"noreferrer noopener\">Get the Magento 2 Admin Email Notifications<\/a><\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento 2 is a powerful ecommerce platform, but like any complex system, it can encounter errors. If left unchecked, these Magento errors can silently affect store performance, hurt sales, or cause full outages \u2014 all without you knowing. This guide shows you how to enable Magento 2 logging, display errors during development, and introduces a powerful solution: real-time admin email alerts.<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[144,121,122],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Magento 2 Error Logging Setup Guide<\/title>\n<meta name=\"description\" content=\"Learn how to enable error logging in Magento 2, including debug, exception, and system logs. Get real-time admin email alerts for errors and prevent failures.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/plumrocket.com\/learn\/magento-error-logging\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Magento 2 Error Logging Setup Guide\" \/>\n<meta property=\"og:description\" content=\"Learn how to enable error logging in Magento 2, including debug, exception, and system logs. Get real-time admin email alerts for errors and prevent failures.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/plumrocket.com\/learn\/magento-error-logging\" \/>\n<meta property=\"og:site_name\" content=\"Magento Tutorials for Beginners &amp; Professionals\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-27T15:27:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-09T07:34:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2025\/05\/magento-logging-2-1.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts\/2511"}],"collection":[{"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/comments?post=2511"}],"version-history":[{"count":50,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts\/2511\/revisions"}],"predecessor-version":[{"id":2597,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts\/2511\/revisions\/2597"}],"wp:attachment":[{"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/media?parent=2511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/categories?post=2511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/tags?post=2511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}