Where can I find the MySQL Logs in Yii Framework

拥有回忆 提交于 2019-12-11 03:26:56

问题


I found this docs to enable the MySQL logging in the Yii Framework (my goal is it to improve the performance): http://www.yiiframework.com/wiki/235/configuring-cweblogroute-for-db-profiling/

Where can I the logs (after running the application)?

Thanks!


回答1:


If you use CWebLogRoute for logging then you can see your logs in your browser, just below content (like in example you provided).

You can also use CFileLogRoute, and Yii will create a application.log file in protected/runtime. In addition you can define fileName and filePath so you can log db messages in different log file.

'db'=>array(
    'connectionString' => 'mysql:host=localhost;dbname=name',
    'emulatePrepare' => true,
    'username' => 'username',
    'password' => 'password',
    'charset' => 'utf8',
    'enableParamLogging'=>true,
),
'log'=>array(
    'class'=>'CLogRouter',
    'routes'=>array(
        array(
            'class'=>'CFileLogRoute',
            'levels'=>'error, warning',
        ),
        array(
            'class'=>'CFileLogRoute',
            'levels'=>'trace',
            'categories'=>'system.db.CDbCommand',
            'fileName'=>'db.log',
        ),
    ),
),


来源:https://stackoverflow.com/questions/26141105/where-can-i-find-the-mysql-logs-in-yii-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!