Needs work
Project:
Drupal core
Version:
main
Component:
other
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
23 Jun 2018 at 06:06 UTC
Updated:
3 Jul 2025 at 00:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
vegantriathleteNote that it seems like the ModuleInstaller had some weirdness with the constructor not reflecting all the services that were being injected.
Comment #4
dhirendra.mishra commentedPlease find below my patch.Passing $logger_factory service to construct function in #2 patch.
Please review it and test it.
Comment #5
vegantriathlete@dhirendra: can you please include an interdiff so that we know what the difference is between your patch and the original one?
Comment #6
Vidushi Mehta commentedAdded a interdiff file.
Comment #7
joachim commentedLooks ok apart from:
Why is the route builder being added here?
Comment #8
vegantriathleteThe route builder is being added because the service was already injecting the route builder before. In order to inject the logger factory service, it had to come after the route builder. I figured that as long as the route builder was being injected it might as well be used. I wonder if we could / should just skip injecting it completely. However, that seemed like too much of a change for this issue.
Comment #9
vegantriathlete@dhirendra: Good catch noticing that I had forgotten to inject the logger channel factory interface.
Comment #10
joachim commented> I figured that as long as the route builder was being injected it might as well be used. I wonder if we could / should just skip injecting it completely. However, that seemed like too much of a change for this issue.
It does seem like too much of a change. But adding DI boilerplate is increasing the work for when the parameter in services.yml is cleaned up. I would be inclined to file a blocker issue to clean that up first.
Comment #12
martin107 commentedI appreciate issues with a single minded focus...
Reviewers can come in grasp the concept and see that it is repeated ad nauseam.
For this issue, I find myself with the other perspective. There is goodness here that I don't want to delay.
Sure the routeBuilder refinement is out of scope ... but it is easy to see that it too is good/"going in the right direction" .. Yes we should file a follow up
But I would rather not see this issue further delayed.
I hear the drum beat of Drupal9 .. Symfony4 is removing $container->get() so injection is soon to be a thorn in the lion's paw.
Comment #14
dhirendra.mishra commentedDo we need re-rolling of patch here?
Comment #15
dhirendra.mishra commentedComment #16
dhirendra.mishra commentedComment #20
jungleAs needs reroll, adjust the title/scope a little bit.
Comment #21
jungleUnlike #4, injected logger channels instead of the logger factory.
Injected/introduced route building service in #2 was removed, out of scope here.
Tasks left:
__constructchanges.Applied issue summary template to IS
Comment #22
jungleCR added. Adding BC layers.
Comment #23
jungleNo space betwtten
'::'and., addressing.Comment #25
hardik_patel_12 commentedLast patch failed to apply , re-rolling the patch and rearranging use statement alphabetically order. Kindly review a new patch.
Comment #27
jungleCan't fix the tests failed, so instead of inject logger channels, back to inject logger factory.
Comment #28
jungleForgot uploading the patch.
Comment #34
borisson_This needs a reroll because it no longer applies currently, in the last patch, are we sure this fixes all the \Drupal::logger occurances?
I'm also not sure if this is a bug or a task?
Comment #35
ravi.shankar commentedAdded reroll of patch #28 on Drupal 9.5.x. and removed reroll tag.
Comment #36
borisson_This patch does not apply to 10.x and since it introduces a ton of new deprecations I'm not sure if it should go in 9.5 with deprecations to be removed in 10.x or if it should go in both, with the intention to remove the deprecations in 11.x.
Let's start by fixing all the implementations left, I found those with
rg \Drupal::loggercore/modules/locale/src/PoDatabaseWriter.php 240: \Drupal::logger('locale')->error('Import of string "%string" was skipped because of disallowed or malformed HTML.', ['%string' => $translation]); core/modules/system/src/Access/CronAccessCheck.php 24: \Drupal::logger('cron')->notice('Cron could not run because an invalid key was used.'); 28: \Drupal::logger('cron')->notice('Cron could not run because the site is in maintenance mode.'); core/modules/migrate/src/MigrateMessage.php 27: \Drupal::logger('migrate')->log($type, $message); core/modules/migrate_drupal_ui/src/Batch/MigrateUpgradeImportBatch.php 143: \Drupal::logger('migrate_drupal_ui')->error($e->getMessage()); 155: \Drupal::logger('migrate_drupal_ui')->notice($message); 193: \Drupal::logger('migrate_drupal_ui')->error('Operation on @migration failed', ['@migration' => $migration_name]); 198: \Drupal::logger('migrate_drupal_ui')->error('Operation on @migration skipped due to unfulfilled dependencies', ['@migration' => $migration_name]); 215: \Drupal::logger('migrate_drupal_ui')->error($message); core/modules/filter/src/Element/ProcessedText.php 149: return \Drupal::logger($channel); core/modules/filter/src/Plugin/Filter/FilterNull.php 38: \Drupal::logger('filter')->alert('Missing filter plugin: %filter.', ['%filter' => $plugin_id]); core/modules/image/src/Entity/ImageStyle.php 324: \Drupal::logger('image')->error('Failed to create style directory: %directory', ['%directory' => $directory]); 334: \Drupal::logger('image')->error('Cached image file %destination already exists. There may be an issue with your rewrite configuration.', ['%destination' => $derivative_uri]); core/lib/Drupal/Core/Theme/ThemeManager.php 88: $this->logger = \Drupal::logger('theme'); core/lib/Drupal/Core/Extension/ModuleInstaller.php 114: $this->logger = \Drupal::logger('system'); core/lib/Drupal/Core/Entity/EntityDisplayBase.php 571: return \Drupal::logger('system');Comment #37
spokjePretty sure it's too late for
9.5.x/10.0.xto introduce any more deprecations except for module/theme deprecations.So moving this to
10.1.x.Also pretty sure this is a task, since nothing is "broken".
Comment #41
spokjeComment #43
mstrelan commentedFor many of these we should probably autoconfigure the loggers instead Loggers can be autoconfigured for service classes implementing \Psr\Log\LoggerAwareInterface
EDIT: I take it back. Most of these aren't in services, and if they are they use a different logger channel than what is autoconfigured. Perhaps we could make use of LoggerAwareInterface and LoggerAwareTrait though.