summaryrefslogtreecommitdiffstats
path: root/lib/private/log/owncloud.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/log/owncloud.php')
-rw-r--r--lib/private/log/owncloud.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/private/log/owncloud.php b/lib/private/log/owncloud.php
index d16b9537a16..a408e3830d6 100644
--- a/lib/private/log/owncloud.php
+++ b/lib/private/log/owncloud.php
@@ -51,12 +51,22 @@ class OC_Log_Owncloud {
if($level>=$minLevel) {
// default to ISO8601
$format = OC_Config::getValue('logdateformat', 'c');
- $time = date($format, time());
- $entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time);
+ $logtimezone=OC_Config::getValue( "logtimezone", 'UTC' );
+ try {
+ $timezone = new DateTimeZone($logtimezone);
+ } catch (Exception $e) {
+ $timezone = new DateTimeZone('UTC');
+ }
+ $time = new DateTime(null, $timezone);
+ $entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time->format($format));
+ $entry = json_encode($entry);
$handle = @fopen(self::$logFile, 'a');
if ($handle) {
- fwrite($handle, json_encode($entry)."\n");
+ fwrite($handle, $entry."\n");
fclose($handle);
+ } else {
+ // Fall back to error_log
+ error_log($entry);
}
}
}