Hi,
I need to logging SQL-queries into the separate file in production mode.
So, my config.php:
'db'=>array(
'connectionString' => 'mysql:host=<...>;dbname=<...>',
'emulatePrepare' => true,
'username' => '<...>',
'password' => '<...>',
'charset' => 'utf8',
'schemaCachingDuration'=>3600,
'enableParamLogging'=>true,
'enableProfiling'=>true,
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
// logging SQl queries:
'class'=>'CFileLogRoute',
'levels'=>'trace',
'categories'=>'system.db.CDbCommand',
'LogPath' => '/var/log/apache/<...>',
'LogFile' => 'db.trace',
'maxFileSize' => 1024 * 100, //100 MB
),
array(
'class'=>'CFileLogRoute',
'levels'=>'trace, info, profile, warning, error',
'maxFileSize' => 1024 * 100, //100 MB
),
array(
'class'=>'UserCEmailLogRoute',
'levels'=>'error',
'emails' => array(<...>),
'sentFrom' => '<...>',
'subject' => 'Error at <...>'
),
),
),
But, it looks like logging does not work when I commenting YII_DEBUG definition in index.php:
// remove the following lines when in production mode
//defined('YII_DEBUG') or define('YII_DEBUG',true);
What’s wrong?