Logging
In addition to the command arguments described in this topic, see Common arguments.
Run all Magento CLI commands as the file system owner.
Debug logging
By default, Magento writes to the debug log (<install_directory>/var/log/debug.log
) when it is in default or develop mode, but not when it is in production mode. Use the bin/magento setup:config:set --enable-debug-logging
command to change the default value.
As of Magento 2.3.1, you can no longer use the bin/magento config:set dev/debug/debug_logging
command to enable or disable debug logging for the current mode.
To enable debug logging
-
Use the
setup:config:set
command to enable debug logging for the current mode.1
bin/magento setup:config:set --enable-debug-logging=true
-
Flush the cache.
1
bin/magento cache:flush
To disable debug logging
-
Use the
setup:config:set
command to disable debug logging for the current mode.1
bin/magento setup:config:set --enable-debug-logging=false
-
Flush the cache.
1
bin/magento cache:flush
Database logging
By default, Magento writes database activity logs to <install_directory>/var/debug/db.log
.
To enable database logging
-
Use the
dev:query-log
command to enable or disable database logging.1
bin/magento dev:query-log:enable
1
bin/magento dev:query-log:disable
-
In the production mode, run the command for import configuration, because the
bin/magento dev:query-log:disable
command adds settings to theapp/etc/env.php
file:1
bin/magento app:config:import
-
Flush the cache.
1
bin/magento cache:flush
Cron logging
With the release of version 2.3.1, Magento now creates a separate cron
log.
Magento recently made cron logging more verbose, which provided more information but lengthened the system.log
considerably.
Moving cron
info to a dedicated log makes both logs easier to read.
By default, Magento writes cron
info to <install_directory>/var/log/cron.log
.
Syslog logging
By default, Magento writes syslog logs to the operating system syslog
file.
As of Magento 2.3.1, you must use the magento
command to enable or disable the syslog.
The setting in the Admin has been removed.
To enable syslog logging
Logging to syslog
is disabled by default.
-
Use the
setup:config:set
command to change thedev/syslog/syslog_logging
database value totrue
.1
bin/magento setup:config:set --enable-syslog-logging=true
-
Flush the cache.
1
bin/magento cache:flush
To disable syslog logging
-
Use the
setup:config:set
command to change thedev/syslog/syslog_logging
database value tofalse
.1
bin/magento setup:config:set --enable-syslog-logging=false
-
Flush the cache.
1
bin/magento cache:flush