As Magento throws info into system.log and debug.log I can see 3 different types

Is it possible to disable main.INFO and main.DEBUG while keeping main.CRITICAL to avoid large file size for logging files.

5 Answers 5


Magento only logs these kinds of Debug information if you're in developer mode. In production, you wan't have to run the production mode. If you've never done that before, you should try it out locally first.

You can change the Magento mode to production with php bin/magento deploy:mode:set production.

  • production mode still logs a phenomenal amount of noise
    – iphigenie
    Commented Dec 6, 2022 at 11:37

I'm currently digging through this too so here's what I know

In older versions, you could still change error_reporting in app/bootstrap.php

Now, Magento 2 has changed to use Monolog/Logger and the log levels are hard coded as private variables in the logger code

The main log files all extend Magento\Framework\Logger\Handler\Base.php which has the following internal variable

 * @var int
protected $loggerType = Logger::DEBUG;

And all the basic logs are created with their own protected $loggerType value

For example here's \Magento\Framework\Logger\Handler\Exception.php (System.php and Debug.php are similar, Syslog slightly different but also hard coded protected variable)

 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.

namespace Magento\Framework\Logger\Handler;

use Monolog\Logger;

class Exception extends Base
     * @var string
    protected $fileName = '/var/log/exception.log';

     * @var int
    protected $loggerType = Logger::INFO;

So if you just wanted to change it temporarily, the changing the protected $loggerType = Logger::INFO; to, say, protected $loggerType = Logger::ERROR; would do the job

If you wanted a more flexible setup, then the Magento\Framework\Logger\Handler classes would need overriding in a module, just changing the constant

The log levels are in the psr module

const EMERGENCY = 'emergency';
const ALERT     = 'alert';
const CRITICAL  = 'critical';
const ERROR     = 'error';
const WARNING   = 'warning';
const NOTICE    = 'notice';
const INFO      = 'info';
const DEBUG     = 'debug';
  • It is flabbergasting that this is not configurable by design. It is also flabbergasting to me that the system logs and the exception log all have the same base level, instead of one focusing on notices and the second higher level. It is also flabbergasting to me the amount of layout noise put in the INFO feed - I'd really like this to be something that can be turned off!
    – iphigenie
    Commented Oct 27, 2022 at 9:58

Maybe using PHP error handling from your PHP configuration (log_level). PHP can only write specific level and skip previous one.

Hopefully, it will help you.


You can use before plugin for specific function and send message as blank so file will not be grow, but it is bad way


There is good way to rotate log file on some interval basis on server level.

So on daily or configured time basis your file will be rotate so no large data will be there in file.

Explore more Logrotate


You can disable system logging by running command: bin/magento setup:config:set --enable-syslog-logging=false

You can disable debug logging by running command: bin/magento setup:config:set --enable-debug-logging=false

Remember to flush the cache after that: bin/magento cache:flush

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.