From 28890c80698713fefcbdd0e78cbe7176cec21ead Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 22 Dec 2010 11:22:20 -0700 Subject: [PATCH] Horde::logMessage() tweaks Don't try to log until we have the basic framework initialized. Don't throw Exception if logMessage() was called before framework was initialized; ignore instead. --- framework/Core/lib/Horde.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/framework/Core/lib/Horde.php b/framework/Core/lib/Horde.php index 86945d034..3b751f242 100644 --- a/framework/Core/lib/Horde.php +++ b/framework/Core/lib/Horde.php @@ -86,11 +86,12 @@ class Horde static public function logMessage($event, $priority = null, array $options = array()) { - if (!isset($GLOBALS['injector'])) { - throw new Horde_Exception('The default environment is missing. Unable to write log entries!'); + /* Chicken/egg: wait until we have basic framework setup before we + * start logging. */ + if (isset($GLOBALS['conf'])) { + $options['trace'] = 2; + $GLOBALS['injector']->getInstance('Horde_Log_Logger')->log($event, $priority, $options); } - $options['trace'] = 2; - $GLOBALS['injector']->getInstance('Horde_Log_Logger')->log($event, $priority, $options); } /** -- 2.11.0