Is it possible to log queries Yii creates and excecutes? I'm interested in this to optimize DB best for them.
Very helpful would be logging the class name, where this query is initiated.
Is it possible to log queries Yii creates and excecutes? I'm interested in this to optimize DB best for them.
Very helpful would be logging the class name, where this query is initiated.
Yes, every SQL being executed or queried is logged. You just need to configure some log route to dump the logged messages out. See http://www.yiiframew…/topics.logging
Thanks, I read that and tried the following:
'log'=>array( 'class'=>'CLogRouter', 'routes'=>array( array( 'class'=>'CFileLogRoute', 'levels'=>'', 'categories'=>'system.*', 'logPath' => '/home/konstantin/testdrive/', ), ), ),
But nothing appears in the directory I specified
What I'm doing wrong?
Did you specify 'log' component in 'preload' property of app?
Here is a whole config. Where is preload section?
return array( 'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..', 'name'=>'Every Style', // autoloading model and component classes 'import'=>array( 'application.models.*', 'application.components.*', ), // application components 'components'=>array( 'user'=>array( // enable cookie-based authentication 'allowAutoLogin'=>true, ), // uncomment the following to set up database 'db'=>array( // 'connectionString'=>'mysql:host=localhost;dbname=everystyle', 'username'=>'*******', 'password'=>'*******' ), 'authManager' => array( 'class' => 'CDbAuthManager', 'connectionID' => 'db', ), 'log'=>array( 'class'=>'CLogRouter', 'routes'=>array( array( 'class'=>'CFileLogRoute', 'levels'=>'', 'categories'=>'system.*', 'logPath' => '/home/konstantin/testdrive/', ), ), ), ), );
yeah, thanks!
How could I miss that
Thanks a lot for help!