How do I enable and read Magento 2 error logs and exception reports?
Magento 2 error logs are already on by default. General errors go to var/log/system.log and uncaught exceptions to var/log/exception.log, in every mode. Read them over SSH from the Magento root; debug logging is a separate switch for when you need more. Seeing an error page with a record number? The full stack trace is in var/report/, in a file with that number as its name.
Quick answer
You don’t need any setup: Magento 2 writes error logs from the moment you install it. To read the logs, run tail -f var/log/exception.log var/log/system.log from the Magento root. For an “Error log record number” page, open the file in var/report/ named with that number. Extra debug logging needs bin/magento setup:config:set --enable-debug-logging=true and a cache flush.
Where Magento 2 error logs are stored
These paths apply to Magento Open Source and Adobe Commerce 2.4.x on your own server. We checked them against Adobe’s documentation. All paths below are relative to the Magento root directory. Magento Open Source has no admin screen for reading these files, so you need SSH or file access.
| File | What it records | On by default |
|---|---|---|
var/log/system.log | General errors and warnings from core and modules | Yes |
var/log/exception.log | Uncaught exceptions with stack traces | Yes |
var/log/debug.log | Detailed debug output | Default and developer mode only |
var/log/cron.log | Cron job activity, split out of system.log since Magento 2.3.1 | Yes |
var/report/ | One report file per error page shown to a visitor | Yes |
var/debug/db.log | SQL queries | No |
Both system.log and exception.log come from Magento’s built-in Monolog logger, described in Adobe’s logging documentation.
Errors that happen before Magento loads, such as a PHP syntax error after a bad deploy, never reach var/log. Fatal memory errors behave the same way. Check the PHP or web server error log for both.
Adobe Commerce on cloud keeps logs in different places per environment. Adobe’s cloud log locations guide lists the paths for Integration, Staging, and Production.
How to read Magento 2 error logs and reports
Start with steps 1 and 2. Steps 3 to 5 add detail when the default logs aren’t enough.

Step 1: Tail the Magento 2 error logs in real time
SSH into the server, change to the Magento root, and run:
tail -f var/log/exception.log var/log/system.log
Reproduce the problem in the browser while the Magento 2 error logs stream in the terminal. Each new entry appears the moment the failing request writes it. That ties each entry to the exact click behind it. Entries start with a timestamp and a level such as main.CRITICAL or main.ERROR.
For an error that already happened, search instead:
grep -n "CRITICAL" var/log/exception.log | tail -n 20
Step 2: Find the report behind an “error log record number” page
A customer sends a screenshot of an error page with a long number on it. That number is a file name. In production mode, Magento writes the full exception to var/report/ under that name:
cat var/report/123456789012
Inside you’ll find the exception message and stack trace, plus the URL that triggered it. Read the first few lines of the trace: they usually name the module or class at fault.
Step 3: Enable debug logging for more detail
Production mode skips debug.log by default. According to Adobe’s logging configuration guide, you turn it on for the current mode with:
bin/magento setup:config:set --enable-debug-logging=true
bin/magento cache:flush
Older guides still recommend bin/magento config:set dev/debug/debug_logging, but that command stopped controlling debug logging in Magento 2.3.1. Set the flag back to false once you have what you need.
Step 4: Log database queries when SQL is the suspect
For slow pages or failing saves, enable the query log:
bin/magento dev:query-log:enable
bin/magento cache:flush
Queries land in var/debug/db.log until you run bin/magento dev:query-log:disable, so switch it off as soon as you finish.
Step 5: Display errors in the browser on staging or local
On a local or staging copy, run bin/magento deploy:mode:set developer so exceptions render directly in the browser. Another option is to copy pub/errors/local.xml.sample to pub/errors/local.xml. The error page then prints the report contents instead of only the record number.
Is it safe to enable Magento debug logging in production?
- Never print errors on a production storefront. Anyone who triggers the error would see your server’s file paths and module names. Some traces leak database details too.
- db.log records SQL queries as they run, so on a busy store it grows with every page view. Magento does not rotate log files itself, so set up logrotate or a cleanup job and watch disk space.
- Run bin/magento as the file system owner. Commands run as root can leave Magento 2 error logs owned by root. The web server then cannot write to them.
- Old files in var/report pile up as well. Clear them out after you review them.
What common messages in Magento 2 error logs mean
Start with exception.log and the var/report file behind any error page. An SQLSTATE message usually means a missing table or column after an incomplete upgrade. A trace path under app/code, or a vendor folder other than vendor/magento, points to the module at fault.
A weekly scan of Magento 2 error logs catches cron jobs that fail at fixed intervals. Check var/log/cron.log to see which jobs ran around the time of each failure. Scheduled indexers and queued emails depend on cron, so these failures show up as stale prices or missing emails. If the trace points into custom code you can’t untangle, our Magento development team can dig into it with you.
Related Answers
Still need help?
Talk to our Magento experts
Found the error but not the fix? Send us the exception or report trace and we’ll help pin down the module or config behind it.