You are viewing revision #5 of this wiki article.
This is the latest version of this article.
You may want to see the changes made in this revision.
Logging context information (session, user, ...) to the logfile can be of great help tracking down problems with specific users.
This requires Yii 1.0.6
config/main.php
<?php
return array(
// ...
'preload'=>array('log', 'session'),
// ...
'components'=>array(
// ...
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CWebLogRoute',
'levels'=>'trace,info,error,warning',
'filter' => array(
'class' => 'CLogFilter',
'prefixSession' => true,
'prefixUser' => false,
'logUser' => false,
'logVars' => array(),
),
),
),
You could also extend [CLogFilter] to do your own log message decoration.
User Contributed Notes
Leave a comment
If you have any questions, please ask in the forum instead.
Join the conversation to share a note.