This issue is to:

  1. Rename logger.channel.rules to logger.channel.rules_debug
  2. Rename the implementation of this service, RulesLoggerChannel, to RulesDebugLoggerChannel
  3. Ensure all places in the codebase and tests that were using the former logger.channel.rule are re-written to use logger.channel.rules_debug AND that these usages are really intended to log to the debug channel (in-memory logs) and NOT meant to log to the core Drupal dblog (database logs).
  4. Go through the entire D7 codebase and find all the places where rules_log() was used. Make sure that all those uses (actions/conditions, expressions etc.) are ported to D8 using the new logger.channel.rules_debug. (This is being handled by #3103959: Port all D7 uses of rules_log() to the D8 logging system)

As outlined in the parent issue, we need a D8 replacement for the D7 rules_log() function, which was used to send messages to the Rules debug logger (and optionally forward them to the core dblog, controlled by Rules system variables).

It turns out that we already pretty much have this, but it was named RulesLoggerChannel which is deceptive and inaccurate. Deceptive because logger channels in Drupal are, in general, meant to correspond to the old D7 log message 'type', so the normal RulesLoggerChannel would be expected to send logs of type 'rules' to the core Drupal dblog where they would be written to the database. This is the usage practiced everywhere else in Drupal. But that's not what our RulesLoggerChannel does, which is why it is an inaccurate name.

Thus our rules_log() replacement in D8 should be:

/** @var \Drupal\rules\Logger\RulesDebugLoggerChannel $rulesDebugLoggerChannel */
$rulesDebugLoggerChannel = \Drupal::service('logger.channel.rules_debug');
$rulesDebugLoggerChannel->log();

Comments

TR created an issue. See original summary.

tr’s picture

Status: Active » Needs review
StatusFileSize
new22.47 KB

I think this covers most of 1-3 above. But not 4). In addition, I also defined the new logger.channel.rules and injected it into the RulesDebugLoggerChannel because that will be needed in #3101198: [meta] Implement conditional logging and on-screen rendering in RulesDebugLoggingChannel and I wrote this patch before I had separated the issues so I don't want to undo those changes.

tr’s picture

Issue summary: View changes
tr’s picture

StatusFileSize
new22.47 KB

Typo.

tr’s picture

StatusFileSize
new23.2 KB

Again.

  • TR committed f4f8e0a on 8.x-3.x
    Issue #3101194 by TR: Rename logger.channel.rules to logger.channel....
tr’s picture

Committed #5. I think between this and #3101199-3: Create a new rules logger channel for logging things to the database we've covered steps 1, 2, and 3.

Leaving open for step 4, which is going to be a big one as most of that stuff was left out of D8 entirely.

tr’s picture

Issue summary: View changes
Status: Needs review » Fixed
Related issues: +#3103959: Port all D7 uses of rules_log() to the D8 logging system

I've moved step 4 to its own issue, #3103959: Port all D7 uses of rules_log() to the D8 logging system, because it involved a lot of work that I want to separate from this current very simple task.

As the remainder of this issue is fixed and committed, I'm closing this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.