The Drupal core module Database logging monitors your system, capturing system events in a log to be reviewed by an authorized individual at a later time.
Before Drupal 7 this module was called Watchdog.
This is useful for site administrators who want a quick overview of activities on their site. The logs also record the sequence of events, so it can be useful for debugging site errors.
The log is simply a list of recorded events containing usage data, performance data, errors, warnings and operational information. Administrators should check the Drupal core report on a regular basis to ensure their site is working properly.
Database logging is not enabled by default, so it needs to be enabled on the Extend page (http://example.com/admin/modules).
Viewing log messages
To view the log, navigate to the Recent log messages page (http://example.com/admin/reports/dblog)
- On the Recent log messages page, click Filter Log Messages
- Select one or more categories from the Type and Severity columns. Hold down the Ctrl key to select more than one item.
- Click Filter
To clear the filters click Filter Log Messages and click Reset.
Viewing log messages when the site is down
To view the log messages when the site is down you need the core syslog module or drush.
The drush command to see log messages is
drush wd-show. Check drush help wd-show for uses of the command. A particular useful way of using wd-show is with the --tail option:
drush wd-show --tail.
Configuring the log
- Navigate to the Logging and Errors configuration page (/admin/config/development/logging)
- In the Errors and Messages section, specify whether messages will be displayed. In production environments, this is generally set to None.
- In the Database Log Entries to Keep field, select the number of log entries to retain in the database. A cron job must run for this setting to be applied.