Enable logging

WARNING
All Magento CLI commands must be run by the file system owner.

Debug logging

By default, Commerce 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.

INFO
As of Commerce 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

  1. Use the setup:config:set command to enable debug logging for the current mode.

    code language-bash
    bin/magento setup:config:set --enable-debug-logging=true
    
  2. Flush the cache.

    code language-bash
    bin/magento cache:flush
    

To disable debug logging

  1. Use the setup:config:set command to disable debug logging for the current mode.

    code language-bash
    bin/magento setup:config:set --enable-debug-logging=false
    
  2. Flush the cache.

    code language-bash
    bin/magento cache:flush
    

Database logging

By default, Commerce writes database activity logs to the <install-dir>/var/debug/db.log file.

To enable database logging

  1. Use the dev:query-log command to enable or disable database logging.

    code language-bash
    bin/magento dev:query-log:enable
    
    code language-bash
    bin/magento dev:query-log:disable
    
  2. Flush the cache.

    code language-bash
    bin/magento cache:flush
    

Cron logging

With the release of version 2.3.1, Commerce now creates a separate cron log.
Commerce 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, Commerce writes cron info to the <install-directory>/var/log/cron.log file.

Syslog logging

By default, Commerce writes syslog logs to the operating system syslog file.
As of Commerce 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.

  1. Use the setup:config:set command to change the dev/syslog/syslog_logging database value to true.

    code language-bash
    bin/magento setup:config:set --enable-syslog-logging=true
    
  2. Flush the cache.

    code language-bash
    bin/magento cache:flush
    

To disable syslog logging

  1. Use the setup:config:set command to change the dev/syslog/syslog_logging database value to false.

    code language-bash
    bin/magento setup:config:set --enable-syslog-logging=false
    
  2. Flush the cache.

    code language-bash
    bin/magento cache:flush
    
recommendation-more-help
386822bd-e32c-40a8-81c2-ed90ad1e198c