MFB: Set timezone on logging (Bug #8496).
authorJan Schneider <jan@horde.org>
Thu, 20 Aug 2009 16:38:17 +0000 (18:38 +0200)
committerJan Schneider <jan@horde.org>
Thu, 20 Aug 2009 21:53:22 +0000 (23:53 +0200)
framework/Core/lib/Horde.php

index 4c8bba5..5d3a46f 100644 (file)
@@ -118,14 +118,18 @@ class Horde
             : null;
         $message = '[' . ($app ? $app : 'horde') . '] ' . $message . ' [pid ' . getmypid() . ' on line ' . $line . ' of "' . $file . '"]';
 
-        /* Make sure to log in the system's locale. */
+        /* Make sure to log in the system's locale and timezone. */
         $locale = setlocale(LC_TIME, 0);
         setlocale(LC_TIME, 'C');
+        $tz = getenv('TZ');
 
         $logger->log($message, $priority);
 
-        /* Restore original locale. */
+        /* Restore original locale and timezone. */
         setlocale(LC_TIME, $locale);
+        if ($tz) {
+            @putenv('TZ=' . $tz);
+        }
 
         return true;
     }