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)
Comment | File | Size | Author |
---|---|---|---|
#2 | use_logger_channel_factory_interface-2876688-2.patch | 1.36 KB | mtalt |
Comments
Comment #2
mtalt CreditAttribution: mtalt commentedAttached is a patch that replaces LoggerChannelFactory with LoggerChannelFactoryInterface.
Comment #3
mtalt CreditAttribution: mtalt commentedComment #4
mtalt CreditAttribution: mtalt commentedComment #5
jonnyeom CreditAttribution: jonnyeom as a volunteer commentedI have tested and can confirm this patch works. Thanks!
Comment #6
Dave ReidI 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.
Comment #8
Sutharsan CreditAttribution: Sutharsan at LimoenGroen commented@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.