I don't want to clear the watchdog log from the UI each time while debugging. It becomes time consuming and tedious.
Is there a Drupal function to clear the watchdog log inside a module?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communitydb_delete('watchdog')->execute();
The best way to do this is via drush:
$ drush help watchdog-delete Delete watchdog messages. Arguments or options must be provided to specify which messages to delete. Examples: drush watchdog-delete all Delete all messages. drush watchdog-delete 64 Delete messages with id 64. drush watchdog-delete "cron run Delete messages containing the string "cron run succesful". succesful" drush watchdog-delete --severity=notice Delete all messages with a severity of notice. drush watchdog-delete --type=cron Delete all messages of type cron. Arguments: severity Delete messages of a given severity level. type Delete messages of a given type. Aliases: wd-del, wd-delete