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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

darksnow created an issue. See original summary.

darksnow’s picture

Status: Active » Needs review
shabana.navas’s picture

Hope this gets committed asap. As it's extremely useful.

darksnow’s picture

Revisiting this for the first time in a long time and the patch I supplied for this incomplete.

I'll attach one that actually works.

TR’s picture

Your 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.

TR’s picture

Assigned: darksnow » Unassigned
FileSize
3.31 KB

Here is a new patch with the aforementioned coding standards fixes.

TR’s picture

Issue tags: +needs port to Drupal 8
jonathan1055’s picture

This 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.

TR’s picture

Actually 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.

TR’s picture

Status: Needs review » Closed (duplicate)