Logging context information (session, user, ...) to the logfile can be of great help tracking down problems with specific users.

This will be available in Yii 1.0.6.

config/main.php

<?php
    // ...
    '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.



Published:06/05/2009
View The Entire Article