File Logging

Hello,

I try to enable file logging, but it is not working for :(

I just have one file app.log, but my logging is not show up there…

I would like to have separate files for logging, like ‘info.log’ and ‘error.log’.

How can I enable this?

Currently my config looks like this:




        'log' => [

            'traceLevel' => YII_DEBUG ? 3 : 0,

            'targets' => [

                'file' => [

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

                    'levels' => ['trace', 'info'],

                    'categories' => ['yii\*'],

                ],

            ],

        ],



Thanks for your help,

Urkman

And noe more question about Logging:

How can I log the SQL statements, ActiveRecord generates?

Thanks,

Urkman

You can add multiple file targets and filter their contents:




        'log' => [

            'traceLevel' => YII_DEBUG ? 3 : 0,

            'targets' => [

                [

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

                    'levels' => ['trace', 'info'],

                    'categories' => ['yii\*'],

                    'logFile' => '@app\runtime\logs\info.log'

                ],

                [

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

                    'levels' => ['error'],

                    'logFile' => '@app\runtime\logs\error.log'

                ],

// ...

            ],

        ],



ActiveRecord queries are logged automatically.

Hello,

logging is still, not working fine for me :(

I have this configuration:




        'log' => [

            'traceLevel' => YII_DEBUG ? 3 : 0,

            'targets' => [

                [

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

                    'levels' => ['info'],

                    'categories' => ['yii\db\*'],

                    'logFile' => '@app/runtime/logs/sql.log'

                ],

                [

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

                    'levels' => ['info'],

                    'logFile' => '@app/runtime/logs/info.log'

                ],

                [

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

                    'levels' => ['error'],

                    'logFile' => '@app/runtime/logs/error.log'

                ]

            ]

        ],



Now I have all sql statements in the sql.log file, bit there are till the $_GET, $_COOKIE and $_SERVER values logged…

And I would like to only show up my YII::info("TEST") logging in info.log and my YII::error("TEST") logging in error.log.

But in my info.log and error.log everything is logged except the logging I expected :(

What do I need to change?

Thanks,

Urkman

No one with an idea on logging?

http://stuff.cebe.cc/yii2docs/yii-log-target.html#$logVars-detail set this to empty array.