The watchdog-x
commands allow us to list, view, and delete messages from the database log (visible at Admin | Reports | Recent Log Messages). Here is a description of each command:
watchdog-list
presents an interactive screen to list messages of a particular type or severity levelwatchdog-show
prints all details of a particular message ID or lists latest messages based on several filtering optionswatchdog-delete
is used to delete messages from thewatchdog
table. It also has filtering capabilities
Let's go through an example to explain these three commands. Imagine that we are facing an unexpected behavior with our implementation of hook_user_insert
during user registration. At some point of the flow in our custom module, we have added the following watchdog
call in order to verify something:
watchdog('custom_module', 'gotcha!');
After registering as a new user in our website, we can print the latest messages to see our output:
$ cd /home...