Last updated February 7, 2014. Created on June 29, 2001.
Edited by batigolix, gcbound, davidneedham, john@dynapres.nl. Log in to edit this page.

Note that starting with Drupal 6.x, Watchdog has been replaced by the dblog and syslog modules. Dblog is similar to watchdog; Syslog allows Drupal's logging to be integrated with the server's syslog facility.

The watchdog module monitors your system and records system events in a log you can review. This helps you get a quick overview of activity on your site. Since the log records events in sequence, it can also be useful for debugging site errors.

The watchdog log records errors, warnings, usage data, performance data, and operational information. You can filter the entries ("Filter by message type") to view only a particular type of message.

You should check the watchdog report regularly to make sure your site is working properly.

You can

  • view watchdog logs at Administer >> Logs >> Recent log entries (admin/logs/watchdog).
  • configure the length of time logs are archived at Administer >> Site configuration >> Error reporting (admin/settings/error-reporting).

For Drupal 6.x

  • view dblog report at Administer >> Reports >> Recent log entries (admin/reports/dblog).
  • configure the row limit for Database logging at Administer >> Site configuration >> Logging and alerts (admin/settings/logging/dblog).

For Drupal 7.x

  • view dblog report at Administration >> Reports >> Recent log messages (admin/reports/dblog).
  • configure the row limit for Database logging at Administration >> Configuration >> Development >> Logging and errors (admin/config/development/logging).

You should never enable syslog in a shared hosting environment, or on a machine for which you are not an administrator. The logs would go somewhere you can't see, and may annoy the real administrators who could turn you off. Almost all the time, it's best to use dblog Database logging (the default) instead.

On a dedicated hosting (VPS or dedicated server) enabling Syslog logging will provide a performance boost, as not every log message will have to be written to the database.

You can use Watchdog to debug your code directly to a log (instead of printing it to the page or using devel to print in a message), you can use watchdog(). You can find more information about watchdog on api.drupal.org.

Rebuild watchdog database table

The watchdog table is created by the module's dblog.install file. If the watchdog table becomes corrupted and cannot be repaired with phpMyAdmin or MySQL's command line utilities you can easily recreate the watchdog table as follows:

  1. put site in offline mode (admin/settings/site-maintenance)
  2. disable the dblog module (admin/build/modules)
  3. uninstall the dblog module (admin/build/modules/uninstall)
  4. re-enable the dblog module (admin/build/modules)
  5. run /update.php to check for errors, and
  6. put site in on-line mode (admin/settings/site-maintenance)

If desired, use phpMyAdmin or MySQL command line utilities to verify the watchdog table has been recreated.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

rshannon’s picture

The watchdog table is created by the optional core dblog module's dblog.install file. If the watchdog table becomes corrupted and cannot be repaired with phpMyAdmin or MySQL's command line utilities (it happens) you can easily recreate the watchdog table by cycling installation of the dblog module, as follows:

1) put site in offline mode (admin/settings/site-maintenance)
2) disable the dblog module (admin/build/modules)
3) uninstall the dblog module (admin/build/modules/uninstall)
4) re-enable the dblog module (admin/build/modules)
5) run /update.php to check for errors, and
6) put site in on-line mode (admin/settings/site-maintenance).

If desired, use phpMyAdmin or MySQL command line utilities to verify the watchdog table has been recreated.