diff --git a/core/lib/Drupal/Core/Database/Log.php b/core/lib/Drupal/Core/Database/Log.php
index 14f5a38..85f4285 100644
--- a/core/lib/Drupal/Core/Database/Log.php
+++ b/core/lib/Drupal/Core/Database/Log.php
@@ -153,7 +153,10 @@ public function findCaller() {
       if (empty($stack[$i]['class'])) {
         $stack[$i]['class'] = '';
       }
-      if (strpos($stack[$i]['class'], __NAMESPACE__) === FALSE && strpos($stack[$i + 1]['function'], 'db_') === FALSE && !empty($stack[$i]['file'])) {
+      if (strpos($stack[$i]['class'], __NAMESPACE__) === FALSE &&
+          strpos($stack[$i]['class'], 'Drupal\Driver\Database') === FALSE &&
+          strpos($stack[$i + 1]['function'], 'db_') === FALSE &&
+          !empty($stack[$i]['file'])) {
         $stack[$i] += array('file' => '?', 'line' => '?', 'args' => array());
         return array(
           'file' => $stack[$i]['file'],
