Only show backtrace if logging at DEBUG level
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 24 Jan 2011 23:51:55 +0000 (16:51 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 25 Jan 2011 00:04:56 +0000 (17:04 -0700)
Otherwise, things like framework libraries that throw exceptions and
provide way of logging exceptions (e.g. Horde_Imap_Client) give
backtraces for items that should not need to be logged (e.g.
authentication failures).

framework/Core/lib/Horde/Core/Log/Logger.php

index 5e88909..b62b9c6 100644 (file)
@@ -131,10 +131,9 @@ class Horde_Core_Log_Logger extends Horde_Log_Logger
         parent::log($eventob);
 
         /* If logging an exception, log the backtrace too. */
-        if ($event instanceof Exception) {
-            if (class_exists('Horde_Support_Backtrace')) {
-                parent::log((string)new Horde_Support_Backtrace($event), $priority);
-            }
+        if (($event instanceof Exception) &&
+            class_exists('Horde_Support_Backtrace')) {
+            parent::log((string)new Horde_Support_Backtrace($event), Horde_Log::DEBUG);
         }
 
         /* Restore original locale and timezone. */