Here is a way to do it in a custom module:
filter_dblog/filter_dblog.services.yml
services: # Overrides the core logger.dblog service. logger.dblog: class: Drupal\filter_dblog\Logger\DbLog arguments: ['@database', '@logger.log_message_parser'] tags: - { name: logger } - { name: backend_overridable }
filter_dblog/src/Logger/DbLog.php
<?php namespace Drupal\filter_dblog\Logger; use Drupal\dblog\Logger\DbLog as BaseDbLog; /** * Modifies the logger.dblog service. * * @see https://drupal.stackexchange.com/a/222123 * @see https://www.drupal.org/docs/drupal-apis/services-and-dependency-injection/altering-existing-services-providing-dynamic-services */ class DbLog extends BaseDbLog { /** * Prevent logging messages by exact message text. */ const MESSAGE_BLACKLIST = [ // Cron runs every minute. That's a lot of log messages. 'Cron run completed.', ]; /** * Prevent logging messages if they match a regular expression pattern. */ const MESSAGE_BLACKLIST_PATTERNS = [ '/ webform sent .* email\.$/', ]; /** * Messages that use content title. */ const TITLE_MESSAGES = [ '@title completed.', '@title created.', '@title updated.', 'Deleted @title.', '@title draft created.', '@title draft updated.', ]; /** * Pattern to match a webform submission title. */ const WEBFORM_SUBMISSION_TITLE_PATTERN = '/: Submission #\d+$/'; /** * {@inheritdoc} */ public function log($level, $message, array $context = []) { // Skip logging blacklisted messages. if (in_array($message, self::MESSAGE_BLACKLIST)) { return; } // Skip logging messages for content with a matching title pattern. if (isset($context['@title']) && preg_match(self::WEBFORM_SUBMISSION_TITLE_PATTERN, $context['@title'])) { if (in_array($message, self::TITLE_MESSAGES)) { return; } } // Skip logging messages matching a blacklisted pattern. foreach (self::MESSAGE_BLACKLIST_PATTERNS as $pattern) { if (preg_match($pattern, $message)) { return; } } // Log the message. parent::log($level, $message, $context); } }
Note that since this only overrides the DB logger, messages will still show up in the CLI. I'm not sure how to override all of the loggers at once but you could override SysLog was well.
I noticed there's a
WebformSubmissionLogLogger
which may be of use to override.Also, I did this by message in order to be reusable, but there's also a message "channel" and other context parameters that can be checked for in order to skip logging.
- πΊπΈUnited States DamienMcKenna NH, USA
I was able to disable the message using this line in my settings.php file:
$settings['locale_custom_strings_en'][''] = [ // Disable the message logged when Webform submissions are migrated. Remove // this line after the site migration is finished. '@title updated.' => '', ];
- Status changed to Needs review
8 months ago 1:13am 21 March 2024 - πΊπΈUnited States DamienMcKenna NH, USA
Now as a patch file to add details to the README.md about it.
- Status changed to RTBC
8 months ago 1:54pm 21 March 2024 - Status changed to Needs work
8 months ago 7:05pm 27 March 2024 - πΊπΈUnited States DamienMcKenna NH, USA
So, that didn't work correctly - when I was doing limited testing on a site where I was manually rolling back a few records and importing them again it wasn't displaying the message, but when I ran the full from-scratch migration the message was still displayed :-\
- πΊπΈUnited States firewaller
Yeah, #4 doesn't work for me on a fresh migration.
FYI that message is getting logged here: https://git.drupalcode.org/project/webform/-/blob/6.2.x/src/WebformSubmi...
Based on that logic above, the only way to silence these messages in CLI was to disable the "results_disabled" setting in each form temporarily. However, now I'm seeing the error from here: https://git.drupalcode.org/project/webform/-/blob/6.2.x/src/Plugin/Webfo...
That's caused by this logic: https://git.drupalcode.org/project/webform/-/blob/6.2.x/src/Plugin/Webfo...
So I don't think that's a viable approach either.
- πΊπΈUnited States DamienMcKenna NH, USA
Temporary workaround to disable the message in Webform; a hack, if you will.
- Status changed to Needs review
6 months ago 5:34pm 17 May 2024