Logging messages

Logging in SuiteCRM is achieved by accessing the log singleton. Accessing an instance of the logger is as simple as:

Example 11.1: Accessing the log

This can then be used to log a message. Each log level is available as a method. For example:

Example 11.2: Logging messages
LoggerManager::getLogger()->debug('This is a debug message');
LoggerManager::getLogger()->error('This is an error message');

This will produce the following output:

Example 11.3: Logging messages example output
Tue Apr 28 16:52:21 2015 [15006][1][DEBUG] This is a debug message
Tue Apr 28 16:52:21 2015 [15006][1][ERROR] This is an error message

Logging output

The logging output displays the following information by default:

Example 11.4: Logging messages example output
<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.

Log levels

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 (error, fatal and security).

The default log levels (in order of verbosity) are:

  • debug

  • info

  • warn

  • deprecated

  • error

  • fatal

  • security

Generally on a production instance you will use the less verbose levels (probably error or fatal). However whilst you are developing you can use whatever level you prefer. I prefer the most verbose level - debug.

Log file location

The log file, by default, is called suitecrm.log and resides in your installation’s root directory.

But you can change log settings through the UI, under Admin / System settings / Logger Settings.

Content is available under GNU Free Documentation License 1.3 or later unless otherwise noted.