Drupal Logging

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
You are viewing a wiki page. You are welcome to join the group and then edit it. Be bold!

Since drupal 6, they have replaced watchdog logging with dblog.
We are open sourcing one of our library for you to easily log onto the database log "watchdog" table.

/
log to database
* @param string category
* @param string sLog
* @param string sType
* @param array variables
*/
function logger_log($sCategory, $sLog, $sType="info", $aVars=array())
{
switch ($sType)
{
  case "emergency":
   $iType = WATCHDOG_EMERG;
   break;
  case "alert":
   $iType = WATCHDOG_ALERT;
   break;
  case "critical":
   $iType = WATCHDOG_CRITICAL;
   break;
  case "error":
  case "err":
   $iType = WATCHDOG_ERROR;
   break;
  case "warning":
  case "warn":
   $iType = WATCHDOG_WARNING;
   break;
  case "note":
  case "notice":
   $iType = WATCHDOG_NOTICE;
   break;
  case "info":
   $iType = WATCHDOG_INFO;
   break;
  case "debug":
   $iType = WATCHDOG_DEBUG;
   break;
  default:
   $iType = 999;//unknown
}

$aLog = array(
  "user"     => $GLOBALS["user"],
  "type"     => $sCategory,
  "message"   => $sLog,
  "variables"  => $aVars,
  "severity"   => $iType,
  "request_uri" => $_SERVER["REQUEST_URI"],
  "referer"   => $_SERVER["HTTP_REFERER"],
  "ip"     => $_SERVER["REMOTE_ADDR"],
  "timestamp"  => time()
);

dblog_watchdog($aLog);
}

Boston

Group categories

More Specifically

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: