Exceptions should be logged at error level, not debug.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 7 Dec 2010 14:30:05 +0000 (09:30 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 7 Dec 2010 15:10:08 +0000 (10:10 -0500)
Bug: 9430

framework/Db/lib/Horde/Db/Adapter/Base.php

index e17e55b..35c6549 100644 (file)
@@ -523,7 +523,7 @@ abstract class Horde_Db_Adapter_Base implements Horde_Db_Adapter
         try {
             $stmt = $this->_connection->query($sql);
         } catch (Exception $e) {
-            $this->_logInfo($sql, 'QUERY FAILED: ' . $e->getMessage());
+            $this->_logError($sql, 'QUERY FAILED: ' . $e->getMessage());
             $this->_logInfo($sql, $name);
             throw new Horde_Db_Exception((string)$e->getMessage(), (int)$e->getCode());
         }
@@ -754,6 +754,14 @@ abstract class Horde_Db_Adapter_Base implements Horde_Db_Adapter
         $this->_logger->debug($this->_formatLogEntry($name, $sql));
     }
 
+    protected function _logError($error, $name, $runtime = null)
+    {
+        /*@TODO */
+        $name = (empty($name) ? '' : $name)
+              . (empty($runtime) ? '' : sprintf(" (%.4fs)", $runtime));
+        $this->_logger->err($this->_formatLogEntry($name, $sql));
+    }
+
     /**
      * Formats the log entry.
      *