From: Michael M Slusarz Date: Wed, 6 Oct 2010 15:32:23 +0000 (-0600) Subject: Give context to these logging error messages. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f957ed089923f9bcf7512afa32d5feee67ee242a;p=horde.git Give context to these logging error messages. Probably should go through the entire Log library and upgrade the exception error messages. Since these messages can't be logged themeselves (for obvious reasons), they need to be very clear in order to track down the issue. Example: today, I got a 'stream could not be written' fatal error (my logging temp drive was full). However, it was not immediately obvious from the error message what subsystem failed. --- diff --git a/framework/Log/lib/Horde/Log/Handler/Stream.php b/framework/Log/lib/Horde/Log/Handler/Stream.php index 82b2b37b4..faae11f5b 100644 --- a/framework/Log/lib/Horde/Log/Handler/Stream.php +++ b/framework/Log/lib/Horde/Log/Handler/Stream.php @@ -74,11 +74,11 @@ class Horde_Log_Handler_Stream extends Horde_Log_Handler_Base if (is_resource($streamOrUrl)) { if (get_resource_type($streamOrUrl) != 'stream') { - throw new Horde_Log_Exception('Resource is not a stream'); + throw new Horde_Log_Exception(__CLASS__ . ': Resource is not a stream'); } if ($mode != 'a+') { - throw new Horde_Log_Exception('Mode cannot be changed on existing streams'); + throw new Horde_Log_Exception(__CLASS__ . ': Mode cannot be changed on existing streams'); } $this->_stream = $streamOrUrl; @@ -95,8 +95,7 @@ class Horde_Log_Handler_Stream extends Horde_Log_Handler_Base public function __wakeup() { if (!($this->_stream = @fopen($this->_streamOrUrl, $this->_mode, false))) { - $msg = '"' . $this->_streamOrUrl . '" cannot be opened with mode "' . $this->_mode . '"'; - throw new Horde_Log_Exception($msg); + throw new Horde_Log_Exception(__CLASS__ . ': "' . $this->_streamOrUrl . '" cannot be opened with mode "' . $this->_mode . '"'); } } @@ -113,7 +112,7 @@ class Horde_Log_Handler_Stream extends Horde_Log_Handler_Base $line = $this->_formatter->format($event); if (!@fwrite($this->_stream, $line)) { - throw new Horde_Log_Exception("Unable to write to stream"); + throw new Horde_Log_Exception(__CLASS__ . 'Unable to write to stream'); } return true;