Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
During debugging I found it helpful to log information to the watchdog.
While there is a event for adding watchdog entries, I did not find a corresponding action so I created one.
My use case for this was in the case where a rule was triggered by an external callback request. There was no page request, or drush command, so there was nowhere to show a system message. Putting a message in the log seemed like the more sensible approach.
I hope it's helpful.
Comment | File | Size | Author |
---|---|---|---|
#6 | 2681761-6.patch | 3.31 KB | TR |
| |||
#4 | rules_watchdog-2681761-4.patch | 2.19 KB | darksnow |
| |||
rules-watchdog_log-7.x.patch | 1.67 KB | darksnow | |
|
Comments
Comment #2
darksnow CreditAttribution: darksnow commentedComment #3
shabana.navas CreditAttribution: shabana.navas at Acro Commerce commentedHope this gets committed asap. As it's extremely useful.
Comment #4
darksnow CreditAttribution: darksnow at Deeson commentedRevisiting this for the first time in a long time and the patch I supplied for this incomplete.
I'll attach one that actually works.
Comment #5
TR CreditAttribution: TR commentedYour patch adds 2 coding standards errors. See the test result in #4. The patch doesn't have to fix the coding standards errors that already exist - those should be handled in a separate coding standards issue - but we really shouldn't be introducing NEW errors.
Comment #6
TR CreditAttribution: TR commentedHere is a new patch with the aforementioned coding standards fixes.
Comment #7
TR CreditAttribution: TR commentedComment #8
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThis has been worked on before at 7.x
#1349882: Action: Create a watchdog entry
#2170013: Provide system action to write a db watchdog message
Need to make sure we use the best from all of these these patches.
Comment #9
TR CreditAttribution: TR commentedActually the patch in #2170013: Provide system action to write a db watchdog message is much preferable to the one here, and is better than the one in #1349882: Action: Create a watchdog entry.
Neither has tests however, and neither addresses the comments from @fago in[#1349882-20].
I'm going to close this as a duplicate of #1349882: Action: Create a watchdog entry.
Comment #10
TR CreditAttribution: TR commented