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.
- 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:
- put site in offline mode (admin/settings/site-maintenance)
- disable the dblog module (admin/build/modules)
- uninstall the dblog module (admin/build/modules/uninstall)
- re-enable the dblog module (admin/build/modules)
- run /update.php to check for errors, and
- 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.