Psr\Log\NullLogger injected rather than Drupal\dblog\Logger\DbLog

Created on 19 August 2024, 6 months ago

After updating from 10.2 to 10.3, we started to get errors similar to "Argument #6 ($logger) must be of type Drupal\Core\Logger\LoggerChannelInterface, Psr\Log\NullLogger given in Drupal\feeds\FeedsQueueExecutable->__construct()". It appears to affect multiple contrib modules:
https://www.drupal.org/project/patternkit/issues/3457878 πŸ› TypeError after updating to Drupal core 10.3 Needs review
https://www.drupal.org/project/autologout/issues/3456716 πŸ› TypeError: Cannot assign Psr\Log\NullLogger to property Drupal\autologout\AutologoutManager::$logger of type Drupal\Core\Logger\LoggerChannelInterface in Drupal\autologout\AutologoutManager->__construct() RTBC
https://www.drupal.org/project/jsonapi_extras/issues/3456717 πŸ› Logger property of EntityResource should be psr/log compatible Needs review
https://www.drupal.org/project/feeds/issues/3468219 πŸ› TypeError in FeedsQueueExecutable.php after updating Core to 10.3 Fixed
https://www.drupal.org/project/groupmedia/issues/3467943 πŸ› Type error in AttachMediaToGroup.php after updating Core to 10.3 Active

The common fix is to change the type hint for the "logger" argument from "Drupal\Core\Logger\LoggerChannelInterface" to "Psr\Log\LoggerInterface". But on our site, after this change, nothing gets logged since the logger that's injected into the constructor NullLogger does not log. We are expecting Drupal\dblog\Logger\DbLog to be injected instead. Is there a new configuration that we need to set in order to use DbLog? Or is this a bug in the logger factory?

πŸ’¬ Support request
Status

Closed: works as designed

Version

10.3 ✨

Component
Database LoggingΒ  β†’

Last updated 4 months ago

  • Maintained by
  • πŸ‡¦πŸ‡·Argentina @dagmar
Created by

πŸ‡ΊπŸ‡ΈUnited States kevin w

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024