8000 bug #45289 [FrameworkBundle] Fix log channel of TagAwareAdapter (fanc… · symfony/symfony@1b695a9 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 1b695a9

Browse files
bug #45289 [FrameworkBundle] Fix log channel of TagAwareAdapter (fancyweb)
This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle] Fix log channel of TagAwareAdapter | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Forgot to add the tag in #40740, therefore the "app" logger is injected instead of the "cache" one. Commits ------- 494ceaf [FrameworkBundle] Fix log channel of TagAwareAdapter
2 parents d3df7be + 494ceaf commit 1b695a9

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,8 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
19621962
if (method_exists(TagAwareAdapter::class, 'setLogger')) {
19631963
$container
19641964
->getDefinition($name)
1965-
->addMethodCall('setLogger', [new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]);
1965+
->addMethodCall('setLogger', [new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)])
1966+
->addTag('monolog.logger', ['channel' => 'cache']);
19661967
}
19671968

19681969
$pool['name'] = $name;

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,6 +1520,7 @@ public function testCachePoolServices()
15201520
$this->assertEquals([
15211521
['setLogger', [new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]],
15221522
], $tagAwareDefinition->getMethodCalls());
1523+
$this->assertSame([['channel' => 'cache']], $tagAwareDefinition->getTag('monolog.logger'));
15231524
}
15241525
}
15251526

0 commit comments

Comments
 (0)
0