1. drupal
    1. 5
    2. 6
    3. 7
    4. 8
5 watchdog($type, $message, $severity = WATCHDOG_NOTICE, $link = NULL)
6 – 7 watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL)

Log a system message.


$type The category to which this message belongs. Can be any string, but the general practice is to use the name of the module calling watchdog().

$message The message to store in the log. Keep $message translatable by not concatenating dynamic values into it! Variables in the message should be added by using placeholder strings alongside the variables argument to declare the value of the placeholders. See t() for documentation on how $message and $variables interact.

$variables Array of variables to replace in the message on display or NULL if message is already translated or not possible to translate.

$severity The severity of the message, as per RFC 3164. Possible values are WATCHDOG_ERROR, WATCHDOG_WARNING, etc.

$link A link to associate with the message.

See also



▾ 122 functions call watchdog()

actions_do in includes/
Performs a given list of actions by executing their callback functions.
actions_save in includes/
Saves an action and its user-supplied parameter values to the database.
actions_synchronize in includes/
Synchronizes actions that are provided by modules in hook_action_info().
action_example_basic_action in examples/action_example/action_example.module
Action function for action_example_basic_action.
action_example_node_sticky_action in examples/action_example/action_example.module
Action function for action_example_node_sticky_action.
action_example_unblock_user_action in examples/action_example/action_example.module
Action function for action_example_unblock_user_action.
aggregator_aggregator_fetch in modules/aggregator/
Implements hook_aggregator_fetch().
aggregator_form_category_submit in modules/aggregator/
Process aggregator_form_category form submissions.
aggregator_form_feed_submit in modules/aggregator/
Process aggregator_form_feed() form submissions.
aggregator_parse_feed in modules/aggregator/
Parse a feed and store its items.
aggregator_refresh in modules/aggregator/aggregator.module
Checks a news feed for new items.
ajax_get_form in includes/
Get a form submitted via #ajax during an Ajax callback.
authorize_access_denied_page in ./authorize.php
Renders a 403 access denied page for authorize.php.
book_admin_edit_submit in modules/book/
Handle submission of the book administrative page form.
check_markup in modules/filter/filter.module
Run all the enabled filters on a piece of text.
comment_confirm_delete_submit in modules/comment/
Process comment_confirm_delete form submissions.
comment_form_submit in modules/comment/comment.module
Process comment form submissions; prepare the comment, store it, and set a redirection target.
comment_multiple_delete_confirm_submit in modules/comment/
Process comment_multiple_delete_confirm form submissions.
comment_publish_action in modules/comment/comment.module
Publishes a comment.
comment_save_action in modules/comment/comment.module
Saves a comment.
comment_unpublish_action in modules/comment/comment.module
Unpublishes a comment.
comment_unpublish_by_keyword_action in modules/comment/comment.module
Unpublishes a comment if it contains certain keywords.
contact_category_delete_form_submit in modules/contact/
Submit handler for the confirm delete category form.
contact_category_edit_form_submit in modules/contact/
Process the contact category edit page form submission.
contact_personal_form_submit in modules/contact/
Form submission handler for contact_personal_form().
contact_site_form_submit in modules/contact/
Form submission handler for contact_site_form().
drupal_chmod in includes/
Set the permissions on a file or directory.
drupal_convert_to_utf8 in includes/
Convert data to UTF-8
drupal_cron_cleanup in includes/
Shutdown function for cron cleanup.
drupal_cron_run in includes/
Executes a cron run when called.
drupal_deliver_html_page in includes/
Package and send the result of a page callback to the browser as HTML.
drupal_deliver_page in includes/
Delivers a page callback result to the browser in the appropriate format.
drupal_mail in includes/
Compose and optionally send an e-mail message.
drupal_uninstall_modules in includes/
Uninstalls a given list of modules.
drupal_xml_parser_create in includes/
Prepare a new XML parser.
file_copy in includes/
Copies a file to a new location and adds a file record to the database.
file_create_htaccess in includes/
Creates an .htaccess file in the given directory.
file_delete in includes/
Delete a file and its database record.
file_managed_file_save_upload in modules/file/file.module
Given a managed_file element, save any files that have been uploaded into it.
file_move in includes/
Move a file to a new location and update the file's database entry.
file_save_data in includes/
Save a string to the specified destination and create a database file entry.
file_save_upload in includes/
Saves a file upload to a new location.
file_unmanaged_copy in includes/
Copies a file to a new location without invoking the file API.
file_unmanaged_delete in includes/
Delete a file without calling any hooks or making any changes to the database.
forum_confirm_delete_submit in modules/forum/
Implement forms api _submit call. Deletes a forum after confirmation.
hook_file_insert in modules/system/system.api.php
Respond to a file being added.
image_crop_effect in modules/image/
Image effect callback; Crop an image resource.
image_desaturate_effect in modules/image/
Image effect callback; Desaturate (grayscale) an image resource.
image_example_colorize_effect in examples/image_example/image_example.module
Image effect callback; Colorize an image resource.
image_gd_desaturate in modules/system/
Convert an image resource to grayscale.
image_gd_rotate in modules/system/
Rotate an image the given number of degrees.
image_resize_effect in modules/image/
Image effect callback; Resize an image resource.
image_rotate_effect in modules/image/
Image effect callback; Rotate an image resource.
image_scale_and_crop_effect in modules/image/
Image effect callback; Scale and crop an image resource.
image_scale_effect in modules/image/
Image effect callback; Scale an image resource.
image_style_create_derivative in modules/image/image.module
Creates a new image derivative based on an image style.
image_style_deliver in modules/image/image.module
Menu callback; Given a style and image path, generate a derivative.
image_toolkit_invoke in includes/
Invokes the given method using the currently selected toolkit.
locale_add_language in includes/
API function to add a language.
locale_languages_delete_form_submit in modules/locale/
Process language deletion submissions.
locale_translate_edit_form_validate in modules/locale/
Validate string editing form submissions.
locale_translate_import_form_submit in modules/locale/
Process the locale import form submission.
menu_delete_menu_confirm_submit in modules/menu/
Delete a custom menu and all links in it.
menu_item_delete_form_submit in modules/menu/
Process menu delete form submissions.
module_disable in includes/
Disable a given set of modules.
module_enable in includes/
Enables or installs a given list of modules.
node_assign_owner_action in modules/node/node.module
Assigns ownership of a node to a user.
node_delete_confirm_submit in modules/node/
Execute node deletion
node_form_submit in modules/node/
node_make_sticky_action in modules/node/node.module
Sets the sticky-at-top-of-list property of a node to 1.
node_make_unsticky_action in modules/node/node.module
Sets the sticky-at-top-of-list property of a node to 0.
node_multiple_delete_confirm_submit in modules/node/
node_promote_action in modules/node/node.module
Sets the promote property of a node to 1.
node_publish_action in modules/node/node.module
Sets the status of a node to 1 (published).
node_revision_delete_confirm_submit in modules/node/
node_revision_revert_confirm_submit in modules/node/
node_save_action in modules/node/node.module
Saves a node.
node_type_delete_confirm_submit in modules/node/
Process content type delete confirm submissions.
node_type_form_submit in modules/node/
Form submission handler for node_type_form().
node_unpromote_action in modules/node/node.module
Sets the promote property of a node to 0.
node_unpublish_action in modules/node/node.module
Sets the status of a node to 0 (unpublished).
node_unpublish_by_keyword_action in modules/node/node.module
Unpublishes a node containing certain keywords.
openid_verify_assertion_nonce in modules/openid/openid.module
Verify that the nonce has not been used in earlier assertions from the same OpenID provider.
profile_field_delete_submit in modules/profile/
Process a field delete form submission.
profile_field_form_submit in modules/profile/
Process profile_field_form submissions.
search_view in modules/search/
Menu callback; presents the search form and/or search results.
system_actions_delete_form_submit in modules/system/
Process system_actions_delete form submissions.
system_block_ip_action in modules/system/system.module
Blocks the current user's IP address.
system_check_directory in modules/system/system.module
Checks the existence of the directory specified in $form_element.
system_cron in modules/system/system.module
Implements hook_cron().
system_ip_blocking_delete_submit in modules/system/
Process system_ip_blocking_delete form submissions.
system_send_email_action in modules/system/system.module
Sends an e-mail message.
system_test_boot in modules/simpletest/tests/system_test.module
Implements hook_boot().
system_test_exit in modules/simpletest/tests/system_test.module
Implements hook_exit().
taxonomy_form_term_submit in modules/taxonomy/
Submit handler to insert or update a term.
taxonomy_form_vocabulary_submit in modules/taxonomy/
Form submission handler for taxonomy_form_vocabulary().
taxonomy_term_confirm_delete_submit in modules/taxonomy/
Submit handler to delete a term after confirmation.
taxonomy_vocabulary_confirm_delete_submit in modules/taxonomy/
Submit handler to delete a vocabulary after confirmation.
taxonomy_vocabulary_confirm_reset_alphabetical_submit in modules/taxonomy/
Submit handler to reset a vocabulary to alphabetical order after confirmation.
theme in includes/
Generates themed output.
tracker_cron in modules/tracker/tracker.module
Implements hook_cron().
trigger_unassign_submit in modules/trigger/
Submit callback for trigger_unassign() form.
update_access_denied_page in ./update.php
user_admin_settings in modules/user/
Form builder; Configure user settings for this site.
user_block_user_action in modules/user/user.module
Blocks the current user.
user_cancel in modules/user/user.module
Cancel a user account.
user_cancel_confirm_form_submit in modules/user/
Submit handler for the account cancellation confirm form.
user_login_finalize in modules/user/user.module
Finalize the login process. Must be called when logging in a user.
user_login_final_validate in modules/user/user.module
The final validation handler on the login form.
user_logout in modules/user/
Menu callback; logs the current user out, and redirects to the home page.
user_pass_reset in modules/user/
Menu callback; process one time login link and redirects to the user page on success.
user_pass_submit in modules/user/
user_register_submit in modules/user/user.module
Submit handler for the user registration form.
user_user_operations in modules/user/user.module
Implements hook_user_operations().
watchdog_exception in includes/
Log an exception.
_drupal_log_error in includes/
Log a PHP error or exception, display an error page in fatal cases.
_form_validate in includes/
Performs validation on form elements. First ensures required fields are completed, #maxlength is not exceeded, and selected options were in the list of options given to the user. Then calls user-defined validators.
_locale_export_po in includes/
Write a generated PO or POT file to the output.
_locale_import_po in includes/
Parses Gettext Portable Object file information and inserts into database
_locale_rebuild_js in includes/
(Re-)Creates the JavaScript translation file for a language.
_node_query_node_access_alter in modules/node/node.module
Helper for node access functions.
_user_cancel in modules/user/user.module
Last batch processing step for cancelling a user account.


includes/, line 1653

function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) {
  global $user, $base_root;

  static $in_error_state = FALSE;

  // It is possible that the error handling will itself trigger an error. In that case, we could
  // end up in an infinite loop. To avoid that, we implement a simple static semaphore.
  if (!$in_error_state && function_exists('module_implements')) {
    $in_error_state = TRUE;

    // Prepare the fields to be logged
    $log_entry = array(
      'type' => $type, 
      'message' => $message, 
      'variables' => $variables, 
      'severity' => $severity, 
      'link' => $link, 
      'user' => $user, 
      'request_uri' => $base_root . request_uri(), 
      'referer' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '', 
      'ip' => ip_address(), 
      'timestamp' => REQUEST_TIME,

    // Call the logging hooks to log/process the message
    foreach (module_implements('watchdog') as $module) {
      module_invoke($module, 'watchdog', $log_entry);

    // It is critical that the semaphore is only cleared here, in the parent
    // watchdog() call (not outside the loop), to prevent recursive execution.
    $in_error_state = FALSE;