配置如下:
‘components‘ => array( ‘db‘=>array( ‘enableParamLogging‘ => true, ), ‘log‘=>array( ‘class‘=>‘CLogRouter‘, ‘routes‘=>array( array( ‘class‘=>‘CFileLogRoute‘, ‘levels‘=>‘trace,log‘, ‘categories‘ => ‘system.db.CDbCommand‘, ‘logFile‘ => ‘db.log‘, ), ), ), );
参考:http://*.com/questions/10629728/yii-how-to-print-sql-used-by-findall