diff --git a/core/lib/Drupal/Core/Watchdog/WatchdogChannelFactory.php b/core/lib/Drupal/Core/Watchdog/WatchdogChannelFactory.php index f774ff5..8e83f0e 100644 --- a/core/lib/Drupal/Core/Watchdog/WatchdogChannelFactory.php +++ b/core/lib/Drupal/Core/Watchdog/WatchdogChannelFactory.php @@ -23,10 +23,11 @@ class WatchdogChannelFactory extends ContainerAware { * The registered logger for this channel. */ public function getLogger($channel) { - try { - return $this->container->get('watchdog.channel.' . str_replace(' ', '_', $channel)); + $channel_service = 'watchdog.channel.' . str_replace(' ', '_', $channel); + if ($this->container->has($channel_service)) { + return $this->container->get($channel_service); } - catch (\InvalidArgumentException $e) { + else { return $this->container->get('watchdog.channel.default'); } } diff --git a/core/tests/Drupal/Tests/Core/Watchdog/WatchdogLoggerBaseTest.php b/core/tests/Drupal/Tests/Core/Watchdog/WatchdogLoggerBaseTest.php index cdbae9b..b586c48 100644 --- a/core/tests/Drupal/Tests/Core/Watchdog/WatchdogLoggerBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Watchdog/WatchdogLoggerBaseTest.php @@ -12,6 +12,14 @@ */ class WatchdogLoggerBaseTest extends UnitTestCase { + public static function getInfo() { + return array( + 'name' => 'Watchdog logger base', + 'description' => 'Unit tests for the watchdog logger base.', + 'group' => 'Watchdog', + ); + } + /** * {@inheritdoc} */