Access to the controller through the command mode can not be output log

I output in the project root directory:

./yii script/index

A log is recorded in the index method of the ScriptController, but the log is not output in the app.log.

I can generate a log from the browser.

Did you configure logging in console.php?

yes,I’m sure



Try declaring a different log file. Default is @runtime/logs/app.log which did not work for me.

        'log' => [

            'targets' => [


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

                    'logFile' => '@runtime/logs/console.log',

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




Thank you for helping me to solve this problem.