function watchdog_exception

7.x bootstrap.inc watchdog_exception($type, Exception $exception, $message = NULL, $variables = array(), $severity = WATCHDOG_ERROR, $link = NULL)

Logs an exception.

This is a wrapper function for watchdog() which automatically decodes an exception.

Parameters

$type: The category to which this message belongs.

$exception: The exception that is going to be logged.

$message: The message to store in the log. If empty, a text that contains all useful information about the passed-in exception is used.

$variables: Array of variables to replace in the message on display. Defaults to the return value of drupal_decode_exception().

$severity: The severity of the message, as per RFC 3164.

$link: A link to associate with the message.

See also

watchdog()

drupal_decode_exception()

14 calls to watchdog_exception()
block_admin_configure_submit in drupal-7.x/modules/block/block.admin.inc
Form submission handler for block_admin_configure().
block_admin_display_form_submit in drupal-7.x/modules/block/block.admin.inc
Form submission handler for block_admin_display_form().
comment_delete_multiple in drupal-7.x/modules/comment/comment.module
Delete comments and all their replies.
comment_save in drupal-7.x/modules/comment/comment.module
Accepts a submission of new or changed comment content.
drupal_cron_run in drupal-7.x/includes/common.inc
Executes a cron run when called.

... See full list

File

drupal-7.x/includes/bootstrap.inc, line 1654
Functions that need to be loaded on every Drupal request.

Code

function watchdog_exception($type, Exception $exception, $message = NULL, $variables = array(), $severity = WATCHDOG_ERROR, $link = NULL) {

  // Use a default value if $message is not set.
  if (empty($message)) {
    // The exception message is run through check_plain() by _drupal_decode_exception().
    $message = '%type: !message in %function (line %line of %file).';
  }
  // $variables must be an array so that we can add the exception information.
  if (!is_array($variables)) {
    $variables = array();
  }

  require_once DRUPAL_ROOT . '/includes/errors.inc';
  $variables += _drupal_decode_exception($exception);
  watchdog($type, $message, $variables, $severity, $link);
}