日志记录
[php]
array(
......
'preload'=>array('log'),
'components'=>array(
......
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'trace, info',
'categories'=>'system.*',
),
array(
'class'=>'CEmailLogRoute',
'levels'=>'error, warning',
'emails'=>'admin@example.com',
),
),
),
),
)
*1.基本日志功能*
'preload' => array('log'),
'components' => array(
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'trace, info, debug, warn, error, fatal, profile',
'categories'=>'test.*',
'maxFileSize'=>1048576,
'logFile'=>'test.log',
),
array(
'class' => 'CWebLogRoute',
'categories' => 'test.*',
'levels' => CLogger::LEVEL_PROFILE,
'showInFireBug' => true,
'ignoreAjaxInFireBug' => true,
),
array(
'class' => 'CWebLogRoute',
'categories' => 'test.* ',
),
array(
'class'=>'CEmailLogRoute',
'levels'=>'error, warning',
'emails'=>'admin@example.com',
),
),
),
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'categories'=>'db.*',
'logFile'=>'db.log',
),
array(
'class'=>'CFileLogRoute',
'categories'=>'uc.*',
'logFile'=>'uc.log',
),
array(
'class'=>'CFileLogRoute',
'categories'=>'drmc.*',
'logFile'=>'drmc.log',
),
array(
'class'=>'CFileLogRoute',
'levels'=>'error',
'logFile'=>'error.log',
),
array(
'class'=>'CEmailLogRoute',
'categories'=>'uc.*',
'levels'=>'error',
'emails'=>'admaker@baidu.com',
),
array(
'class'=>'CWebLogRoute'
'levels'=>'trace,info,profile,warning,error',
),
)
http://www.yiichina.com/doc/guide/1.1/topics.logging
http://www.tuicool.com/articles/yE7VJb
http://orangeholic.iteye.com/blog/1688461