在main.php文件中,设置log
'log' => array(
'class' => 'CLogRouter' ,
'routes' => array(
array(
'class' => 'CFileLogRoute' ,
'levels' => 'error, warning,trace,info'
) ,
// the following to show log messages on web pages
array(
'class' => 'CWebLogRoute' ,
'enabled' => YII_DEBUG //如果
) ,
)
),
If you don’t define YII_DEBUG, Yii will do it in YiiBase.php:
There’s a minor gotcha there since YII_DEBUG is always defined in yiibase like this
defined(‘YII_DEBUG’) or define(‘YII_DEBUG’,false);
and this test, placed anywhere after the line in the index call to
Yii::createWebApplication($config)->run();
will always show YII_DEBUG as defined, no matter that it is defined by define(‘YII_DEBUG’,false);
网友评论