Other modules, such as Redirect 404, may implement their own LoggerChannelFactory and override Core's. If this happens, the radioactivity module will error because the LoggerChannelFactory class is being used in the __construct of RadioactivityProcessor.

TypeError: Argument 4 passed to Drupal\radioactivity\RadioactivityProcessor::__construct() must be an instance of Drupal\Core\Logger\LoggerChannelFactory, instance of Drupal\redirect_404\Render\Redirect404LogSuppressor given, called in /var/www/sitename/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 284 in Drupal\radioactivity\RadioactivityProcessor->__construct() (line 65 of /var/www/sitename/web/modules/contrib/radioactivity/src/RadioactivityProcessor.php)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mtalt created an issue. See original summary.

mtalt’s picture

Attached is a patch that replaces LoggerChannelFactory with LoggerChannelFactoryInterface.

mtalt’s picture

Issue summary: View changes
mtalt’s picture

Status: Active » Needs review
jonnyeom’s picture

I have tested and can confirm this patch works. Thanks!

Dave Reid’s picture

I think this should be changed to just use \Psr\Log\LoggerInterface instead of the logger channel factory, unless there's a specific need to have the factory instead of the logger itself.

  • Sutharsan committed 709a060 on 8.x-3.x authored by mtalt
    Issue #2876688 by mtalt: Use LoggerChannelFactoryInterface instead of...
Sutharsan’s picture

Status: Needs review » Fixed

@DaveReid From looking at the usage of LoggerInterface this in used for the actual loggers (i.e. dblog and syslog). Not for adding a message to the log. The procedural equivalent Drupal::logger is used all over for this.

Status: Fixed » Closed (fixed)

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