Search code examples
debuggingyii2

Yii2 disable debug log for specific controller/action


In general in development mode i have to use the debug and logging for bugtracing.

But on a specific controller/action i don't want this to happen since it's just a background ajax that gets called every 2 seconds, which ends ups in a huge amount of "unneeded" logs.

How can I exclude this specific call "site/ajaxupdate" from being logged?


Solution

  • You could simply disable the corresponding log target in your controller, e.g. :

    \Yii::$app->log->targets['file']->enabled = false;
    

    Read more about toggling log targets.