Reputation: 400
I am using YII 1.0 logger but i am not able to print YII logs without Yii::app()->end.
Below is my test program :
$test = 123;
if($test){
Yii::log('Test', CLogger::LEVEL_INFO, "This is for testing");
}
Below is my configuration settings :
'log' => array(
'class' => 'CLogRouter',
'routes' => array(
array(
'class' => 'CFileLogRoute',
'levels' => 'trace, info, error, warning, vardump',
),
array(
'class' => 'CWebLogRoute',
'enabled' => YII_DEBUG,
'levels' => 'error, warning, trace, notice',
'categories' => 'application',
'showInFireBug' => true,
),
array(
'class'=>'CFileLogRoute',
'logFile'=>'custom.log',
'categories'=>'custom.*',
),
),
),
Is there something wrong in my code ? Thanks in advance.
Upvotes: 0
Views: 135
Reputation: 46
Messages can be logged using yii::log
,
syntax:
Yii::log($message, $level, $category);
example:
Yii::log("This is for testing","error","custom");
Upvotes: 1
Reputation: 2267
You may learn CLogger api for more useful information.
Yii::getLogger()->flush(true);
Also hope it helps:
http://www.yiiframework.com/forum/index.php?/topic/8158-logger-and-flush-problem/
Upvotes: 1