Logging Mechanism in SugarCRM

The log files is useful in examining the workings of the application. The usual method is to show the variable using echo or exit function but it is not sufficient because, sometimes, the application may choose to redirect to another pages, or it only shows incomplete state of the program.

One of the cases I’ve found when try to examine the authentication mechanism at the login process in SugarCRM application. At the callstack information, I’ve notice there should be some call to the page(s) involved in the authentication process. This is done by a series of includeClassicFile method call in SugarView.php by passing the $file parameter.

At first, I try to call the echo and exit to view the $file and it only show DisplayWarnings.php and then Login.php. Examining codes related in those pages reveals no indication of routines related to authentication process.

Here comes SugarCRM logging to the rescue. The logging facillity can be configured using logger variable in config.php file. The default level will be ‘fatal’ and the available level (as defined in LoggerManager.php) as follows:


The level corresponds to the method to be called when doing the logging, for example, for info level:

$GLOBALS[‘log’]->info(‘My Log Info ‘ . $file);

By configuring the log level to info, and place the above routine to the called module, I’ve found, there indeed a call to Authentication page:

08/21/14 10:03:06 [5512][-none-][INFO] My Info Authenticate


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: