From 864d3e31153b28c99b9a21962ddfff18a54375d0 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Tue, 7 Dec 2010 09:30:05 -0500 Subject: [PATCH] Exceptions should be logged at error level, not debug. Bug: 9430 --- framework/Db/lib/Horde/Db/Adapter/Base.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/framework/Db/lib/Horde/Db/Adapter/Base.php b/framework/Db/lib/Horde/Db/Adapter/Base.php index e17e55b18..35c654974 100644 --- a/framework/Db/lib/Horde/Db/Adapter/Base.php +++ b/framework/Db/lib/Horde/Db/Adapter/Base.php @@ -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. * -- 2.11.0