tirsdag den 17. september 2013

Yii - How to enable SQL logging

'db'=>array(
            'connectionString' => 'mysql:host=localhost;dbname=version2',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
            'tablePrefix' => '',
            'enableProfiling'=>true, // add this line to the db config
        ),

You should remember to uncomment the routes:

'log'=>array(
            'class'=>'CLogRouter',
            'routes'=>array(
                // Default Class Profile Log Route
                array(
                    'class'=>'CProfileLogRoute',
                    'report'=>'summary',
                    // lists execution time of every marked code block
                    // report can also be set to callstack
                ),
           
                // yii-debug-toolbar is a good debugging tool(bar)
                array(
                    'class'=>'ext.yii-debug-toolbar-master.yii-debug-toolbar.YiiDebugToolbarRoute',
                    'ipFilters'=>array('127.0.0.1','192.168.1.19'),
                ),
            ),
        ),

Ingen kommentarer:

Send en kommentar