From 494ceaf6cc02ca7b55e12381d1869c5c589bd4aa Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Wed, 2 Feb 2022 16:57:39 +0100 Subject: [PATCH] [FrameworkBundle] Fix log channel of TagAwareAdapter --- .../FrameworkBundle/DependencyInjection/FrameworkExtension.php | 3 ++- .../Tests/DependencyInjection/FrameworkExtensionTest.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index eb3b19991bb92..0d52c684b27d0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1962,7 +1962,8 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con if (method_exists(TagAwareAdapter::class, 'setLogger')) { $container ->getDefinition($name) - ->addMethodCall('setLogger', [new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]); + ->addMethodCall('setLogger', [new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]) + ->addTag('monolog.logger', ['channel' => 'cache']); } $pool['name'] = $name; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 396a04e8b4bf9..b66d0837c3a37 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -1520,6 +1520,7 @@ public function testCachePoolServices() $this->assertEquals([ ['setLogger', [new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]], ], $tagAwareDefinition->getMethodCalls()); + $this->assertSame([['channel' => 'cache']], $tagAwareDefinition->getTag('monolog.logger')); } }