To enable logger you have turn it "On" via <code>config/config.main.php</code> file.
Code: Select all
// Logger settings
'log' => array(
'enable' => true,
'path' => 'protected/tmp/logs/',
'fileExtension' => 'php',
'dateFormat' => 'Y-m-d H:i:s',
'threshold' => 1,
'filePermissions' => 0644,
'lifetime' => 30 /* in days */
),
After logger is turned "On" you may use it by yourself in the code with following syntax:
Code: Select all
CLog::addMessage('error', 'Error description');
CLog::addMessage('debug', 'Debug description');
CLog::addMessage('info', 'Info description');
Example of usage:
Code: Select all
try{
// Your code here...
}catch(Exception $e){
CLog::addMessage('debug', 'Exception caught: ', $e->getMessage(), "\n");
}