1 /basic/config/web.php 添加

'bootstrap' => ['log'],
'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning','info'],
                    'logVars' => ['*'],
                    //'categories' => ['application'],
                    //'logFile' => '@runtime/logs/app.log',
                ]
            ],
        ],

2 log打印

Yii::warning("warning message");
Yii::error("error message");
Yii::info("info message");

相关文章:

  • 2022-02-20
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案