Skip to content

Commit

Permalink
fix: check for handler existence before adding processor
Browse files Browse the repository at this point in the history
  • Loading branch information
cdaguerre committed Aug 31, 2022
1 parent 4e33863 commit 7de3318
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/DependencyInjection/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,10 @@ protected function loadLogging(array $config, ContainerBuilder $container): void
}

foreach ($config['handlers'] as $handler) {
$container->getDefinition(\Instrumentation\Logging\Processor\TraceContextProcessor::class)
->addTag('monolog.processor', ['handler' => $handler]);
if ($container->hasDefinition(sprintf('monolog.handler.%s', $handler))) {
$container->getDefinition(\Instrumentation\Logging\Processor\TraceContextProcessor::class)
->addTag('monolog.processor', ['handler' => $handler]);
}
}

$container->setParameter('logging.trace_context_keys', $map);
Expand Down

0 comments on commit 7de3318

Please sign in to comment.