summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-10-07 15:34:48 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-10-07 15:34:48 +0200
commit6a411833b9167278aa5667412ee96c30e87f8241 (patch)
tree51e724843d1c225c2da57e20b04db621ac68c85b /lib
parent0d492afee1ed6a6c032451181c20fd0b90f3105e (diff)
downloadnextcloud-server-6a411833b9167278aa5667412ee96c30e87f8241.tar.gz
nextcloud-server-6a411833b9167278aa5667412ee96c30e87f8241.zip
let admin specify timezone for log file entries
Diffstat (limited to 'lib')
-rw-r--r--lib/private/log/owncloud.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/private/log/owncloud.php b/lib/private/log/owncloud.php
index d16b9537a16..528c6bc38be 100644
--- a/lib/private/log/owncloud.php
+++ b/lib/private/log/owncloud.php
@@ -50,9 +50,11 @@ class OC_Log_Owncloud {
$minLevel=min(OC_Config::getValue( "loglevel", OC_Log::WARN ), OC_Log::ERROR);
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);
+ $format = OC_Config::getValue('logdateformat', 'Y-m-d H:i:s');
+ $logtimezone=OC_Config::getValue( "logtimezone", 'UTC' );
+ $timezone = new DateTimeZone($logtimezone);
+ $time = new DateTime(null, $timezone);
+ $entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time->format($format));
$handle = @fopen(self::$logFile, 'a');
if ($handle) {
fwrite($handle, json_encode($entry)."\n");