log
通过配置Web.config来完成
1 数据库增加 ‘前缀_log’表
2 配置Web.config
'bootstrap' => ['log'], 'components' =>[ 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, //级别 'targets' => [ 'file' => [ //使用文件存储日志 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], ], 'legcc' =>[ //自定义模式 [例如发邮件、微信等] 'class' => 'app\components\LegccLogTarget', 'levels' => ['error', 'warning'], 'categories' => [ 'yii\db\*', 'yii\web\*', 'yii\base\*', ], 'except' => [ 'yii\web\HttpException:404', ], 'logVars' => [], ], 'db' =>[ //使用数据库存储日志 'class' => 'yii\log\DbTarget', 'levels' => ['error', 'warning'], 'categories' => [ 'yii\db\*', 'yii\web\*', 'yii\base\*', ], 'except' => [ 'yii\web\HttpException:404', ], 'logVars' => ['_GET', '_POST', '_COOKIE', '_SESSION', '_SERVER'], ], ], ], ]