Currently the previously set logger is overwritten by the bundle in the compiler pass.
$doctrine = $container->getParameter('doctrine.connections');
foreach ($doctrine as $connectionId) {
$container
->getDefinition(sprintf('%s.configuration', $connectionId))
->addMethodCall('setSQLLogger', [new Reference('app_insights_php.doctrine.logger.dependency')]);
}
As there is already a logger chain defined where the logger can be added to (at least for me in symfony 4.4 with doctrine 2.7) the logger should be added to that chain instead of replacing it.
$container->getDefinition('doctrine.dbal.logger.chain')
->addMethodCall('addLogger', [new Reference('app_insights_php.doctrine.logger.dependency')]);