Rules provides several actions on behalf of core modules. For system we have drupal_message, redirect, mail etc but one common action missing from this list is drupal_watchdog. It is very useful to have the ability for a user rule to write to the db log. It just requires an extra entry in the rules_system_action_info() array in /modules/system.rules.inc and the corresponding function added to /modules/system.eval.inc

Patch coming up.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jonathan1055’s picture

Status: Active » Needs review
FileSize
1.54 KB

Patch against 7.x-2.6
The message category is currently fixed at 'Rules - custom' but this could be changed to a user text entry parameter.

jonathan1055’s picture

FileSize
2.52 KB

Here is an enhanced version, with the ability to specify the message identifier (column 1 in the dblog) and also to provide a link for the final column. Patch against 7.x-2.7

hargobind’s picture

Status: Needs review » Closed (duplicate)

There is an older thread at #1349882: Action: Create a watchdog entry where this feature is being discussed. Please merge your changes into that thread.
P.S. I like the configurability of the message identifier and link text in your patch.

TR’s picture

I posted patch #2 to #1349882: Action: Create a watchdog entry in comment #34, as it is better than the patch that was being considered there. Please participate in that discussion to get this fixed!

jonathan1055’s picture

Thanks for moving the patch, and for the credit on that issue. There are more participants there, which is good.