HOW TO enable error logging?

Discuss everything related to ApPHP Durecty CMF. All versions. Any questions related to the Directy CMF developing or using should be posted to this forum.

Moderators: alexandrleonenko, alexmst

administrator
Site Admin
Site Admin
Posts: 6011
Joined: Jan 7th, '09, 23:18
Contact:

HOW TO enable error logging?

Postby administrator » Oct 18th, '16, 10:04

Directy CMF has embedded features to log errors, warnings, etc.
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");
}

Return to “ApPHP Directy CMF {developers/users}”