为什么在Yii2中没有在app.log中登录任何内容?

时间:2019-01-29 09:04:29

标签: yii2 yii2-log

我在这里遇到同样的问题:

Write info message in app.log file using yii2

但是该主题没有解决方案。 Apache用户具有对logs文件夹的写许可权。我不知道为什么记录不起作用。

有任何评论吗?

这是config / main.php文件中的内容:

'log' => [
        'traceLevel' => YII_DEBUG ? 3 : 0,
        'targets' => [
            [
                'class' => 'yii\log\FileTarget',
                'levels' => ['error', 'warning'],
            ],

            [
                'class' => 'yii\log\FileTarget',
                'levels' => ['info'],
                'categories' => ['records'],
                'logFile' => '@app/runtime/logs/records.log',
                'maxFileSize' => 1024 * 2,
                'maxLogFiles' => 20,
            ],
        ],
    ],

以及我用来写入日志文件的内容:

Yii::info('Sample text.', 'records');

0 个答案:

没有答案