Skip to content

Instantly share code, notes, and snippets.

@maranemil
Last active August 29, 2015 14:10
Show Gist options
  • Save maranemil/f44564b52d3aa9c3fc66 to your computer and use it in GitHub Desktop.
Save maranemil/f44564b52d3aa9c3fc66 to your computer and use it in GitHub Desktop.
Debug in SugarCRM
<?php
// most entry points have this, except soap.php
// require_once ('log4php/LoggerManager.php'); # deprecated
require_once('include/SugarLogger/LoggerManager.php');
$GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
// depending on what your log level is set at in log4php.properties
$GLOBALS['log']->fatal(msg);
$GLOBALS['log']->debug(msg);
$GLOBALS['log']->info(msg);
$GLOBALS['log']->test('This is my test log message');
$GLOBALS['log']->fatal("print some array: " . print_r($array, true));
$GLOBALS['db']->query($sql);
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 : Logs severe error events that leads the application to abort. This is the default level.
Security : Logs events that may compromise the security of the application.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment