Logging in SuiteCRM is achieved by accessing the log global. Accessing an instance of the logger is as simple as
This can then be used to log a message. Each log level is available as a method. For example:
$GLOBALS['log']->debug('This is a debug message'); $GLOBALS['log']->error('This is an error message');
This will produce the following output:
Tue Apr 28 16:52:21 2015 [DEBUG] This is a debug message Tue Apr 28 16:52:21 2015 [ERROR] This is an error message
The logging output displays the following information by default:
<Date> [<ProcessId>][<UserId>][<LogLevel>] <LogMessage>
The date and time that the message was logged.
The PHP process id.
The ID of the user that is logged into SuiteCRM.
The log level for this log message.
The contents of the log message.
Depending on the level setting in admin some messages will not be added
to the log e.g if your logger is set to
error then you will only see
log levels of
error or higher (
The default log levels (in order of verbosity) are:
Generally on a production instance you will use the less verbose levels
fatal). However whilst you are developing you can
use whatever level you prefer. I prefer the most verbose level -
Content is available under GNU Free Documentation License 1.3 or later unless otherwise noted.