发布于 2年前

Yii2 设置 分类型分日期保存日志

直接上代码:

'log' => [
    'traceLevel' => YII_DEBUG ? 3 : 0,
    'targets' => [
        [
            'class' => 'yii\log\FileTarget',
            'levels' => ['error'],
            'logFile' => '@runtime/logs/'.date('Ym').'/app.error.log',
        ],
        [
            'class' => 'yii\log\FileTarget',
            'levels' => ['warning'],
            'logFile' => '@runtime/logs/'.date('Ym').'/app.warning.log',
        ],
    ],
],
©2020 edoou.com   京ICP备16001874号-3