diff --git a/core/modules/dblog/src/Logger/DbLog.php b/core/modules/dblog/src/Logger/DbLog.php
index a841430..b91f2d6 100644
--- a/core/modules/dblog/src/Logger/DbLog.php
+++ b/core/modules/dblog/src/Logger/DbLog.php
@@ -9,6 +9,7 @@
 
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Database\Connection;
+use Drupal\Core\Database\Database;
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Core\DependencyInjection\DependencySerializationTrait;
 use Drupal\Core\Logger\LogMessageParserInterface;
@@ -23,11 +24,16 @@ class DbLog implements LoggerInterface {
   use DependencySerializationTrait;
 
   /**
+   * The dedicated database connection target to use for log entries.
+   */
+  const DEDICATED_DBLOG_CONNECTION_TARGET = 'dedicated_dblog_connection';
+
+  /**
    * The database connection object.
    *
    * @var \Drupal\Core\Database\Connection
    */
-  protected $database;
+  protected $connection;
 
   /**
    * The message's placeholders parser.
@@ -44,8 +50,13 @@ class DbLog implements LoggerInterface {
    * @param \Drupal\Core\Logger\LogMessageParserInterface $parser
    *   The parser to use when extracting message variables.
    */
-  public function __construct(Connection $database, LogMessageParserInterface $parser) {
-    $this->database = $database;
+  public function __construct(Connection $connection, LogMessageParserInterface $parser) {
+    $key = $connection->getKey();
+    $info = Database::getConnectionInfo($key);
+    // We open a dedicated connection for logging to ensure that errors that
+    // mess up the default connection are logged.
+    Database::addConnectionInfo($key, self::DEDICATED_DBLOG_CONNECTION_TARGET, $info['default']);
+    $this->connection = Database::getConnection(self::DEDICATED_DBLOG_CONNECTION_TARGET, $key);
     $this->parser = $parser;
   }
 
@@ -60,7 +71,7 @@ public function log($level, $message, array $context = array()) {
     // translated too in runtime.
     $message_placeholders = $this->parser->parseMessagePlaceholders($message, $context);
 
-    $this->database
+    $this->connection
       ->insert('watchdog')
       ->fields(array(
         'uid' => $context['uid'],
