Yii 1.1: csslowlogroute

Log profile entries slower than treshold or more frequent than treshold
4 followers

This log route logs profile entries slower than provided treshold in seconds or more frequent than provided treshold. It does not show those entries on web page so you can turn it on even on production site (for some time) to debug bottlenecks.

Requirements

based on standard CFileLogRoute, profile processing took from CProfileLogRoute, should work with every Yii version (tested on 1.1.9)

Usage

just extract extension in your application extensions directory and put configuration in your config file:

'log'=>array(
    'class'=>'CLogRouter',
    'routes'=>array(
        array( 'class'=>'ext.CSSlowLogRoute',
            'logSlow'=>3, //log profile entries slower than 3 seconds (you can use decimals here)
            'logFrequent'=>3 //log profile entries which occured more than 3 times
        ),
    ),
),

you can also turn on profiling on database queries to get them in slowlog:

'db'=>array(
    ...
    'enableParamLogging'=>true,
    'enableProfiling'=>true,
),

Be the first person to leave a comment

Please to leave your comment.

Create extension