Introduction
We use SugarCRM log to monitor SugarCRM system. The SugarLogger class is located in ./include/SugarLogger/SugarLogger.php. It allows us to log system events to a log file.
Log Configuration
Log configuration is in config.php file in sugarCRM root.
'logger' =>
array (
'level' => 'fatal',
'file' =>
array (
'ext' => '.log',
'name' => 'sugarcrm',
'dateFormat' => '%c',
'maxSize' => '10MB',
'maxLogs' => 10,
'suffix' => '',
),
),
The logging level can be:
- Debug : Logs events that help in debugging the application.
- Info : Logs informational messages and database queries.
- Warn : Logs potentially harmful events.
- Error : Logs error events in the application.
- Fatal : (Default) Logs severe error events that may cause the application to abort.
- Security : Logs events that may compromise the security of the application.
- Off : The logger will not log any events.
Log level can also be set in Admin > System Settings.
Default log file is sugarcrm.log but that can also be changed in configuration. When this file gets over 10MB new file will be created, by default 10 files will be created. After that, it will start to overwrite the first file.
Example of logging
You can use SugarCRM log in code like this:
// Log fatal
$GLOBALS['log']->fatal('Checking if invoice has been uploaded');
View log
In SugarCRM you can check log file by going to Administration > System Settings and at the end of Log part, there is a link to view Log file.
Read about SugarCRM Logic Hooks here.
Comments
SugarCRM - Logic Hooks - Compiled web read about SugarCRM Logic Hooks
[…] Read about SugarCRM logging here. […]