@gabe
2016-01-11T23:45:08.000000Z
字数 391
阅读 2192
Yii2
log
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
'file' => [
'class' => 'yii\log\FileTarget',
'levels' => YII_DEBUG ? ['error','warning','info','trace','profile'] : ['error', 'warning'],
'categories' => [],
'logFile' => getenv('LOG_FILE_PATH')?:null,
'logVars'=> [],
],
],
],
记录信息Yii::error
,Yii::warning
,Yii::info
等。做开发api时可以在有错误时输出到页面。
$messages = Yii::getLogger()->messages;
print_r($messages);