All error logs to file A but one category to file B


The Cookbook tells tow to dispatch various log categories to different files:

But they put "category" option for each entry.

On the other hand I would like to log ALL to file A but one special category to file B.

Will this work as expected:

'components' => [

    'log' => [

        'targets' => [


                    'class' => 'yii\log\FileTarget',

                    'logFile' => '@app/runtime/logs/A.log',



                    'class' => 'yii\log\FileTarget',

                    'categories' => ['special'],

                    'logFile' => '@app/runtime/logs/B.log',




Can you advise?

Thanks ahead!


'except' => ['special'],

for the first one.$except-detail

(or if I read this wrong and you want to keep everything with ‘special’ in A and only ‘special’ in B leave it as it is, it’s good).