Several Log Files do not work properly


I use a Yii2 advanced app and I would like to have 2 kind of log files.

One just displaying _Server _Session, has it is in app.log when you get fresh Yii2 app, and the other where i send my own trace info.

Then I did this in my main.php config file:

            'targets' => [


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

                    'levels' => ['error', 'warning'],



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

                    'levels' => ['info'],

                    'categories' => ['sensitive'],

                    'logFile' => '@backend/runtime/logs/sensitive/sensitive.log',

                    'maxFileSize' => 1024 * 2,

                    'maxLogFiles' => 20,



And i call


for sending in sensitive.log

As a result I get the messages from Yii::info(‘blblbla’,‘sensitive’); but I get ALSO every message from _Server, _Session, $_Cookie

And I do not want that. I was expected to have it in my app.log, but it remains empty …

Do you know how to sole this problem ?


Search for logVars under Message Formatting in the logging guide:

It tells you how to remove unrequired information like cookies and server data. I don’t know why it is added by default…but it is!

Thx very much, I missed the information