diff options
author | Björn Schießle <bjoern@schiessle.org> | 2013-10-09 01:59:09 -0700 |
---|---|---|
committer | Björn Schießle <bjoern@schiessle.org> | 2013-10-09 01:59:09 -0700 |
commit | b4df4cc61d897703176b0ca5cad7fa687ddd059b (patch) | |
tree | 43053b3984edc24c0805b71947aff80b9261db6b | |
parent | a18ebac108ad58d7b4298489fcb7ed3f22a99bb5 (diff) | |
parent | c1e5725db99e046792ce68edfea406259a8a2877 (diff) | |
download | nextcloud-server-b4df4cc61d897703176b0ca5cad7fa687ddd059b.tar.gz nextcloud-server-b4df4cc61d897703176b0ca5cad7fa687ddd059b.zip |
Merge pull request #5219 from owncloud/catch_wrong_timezone
catch unknown timezone and fall-back to UTC
-rw-r--r-- | lib/private/log/owncloud.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/log/owncloud.php b/lib/private/log/owncloud.php index 528c6bc38be..f3b43584409 100644 --- a/lib/private/log/owncloud.php +++ b/lib/private/log/owncloud.php @@ -50,9 +50,13 @@ 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', 'Y-m-d H:i:s'); + $format = OC_Config::getValue('logdateformat', 'c'); $logtimezone=OC_Config::getValue( "logtimezone", 'UTC' ); - $timezone = new DateTimeZone($logtimezone); + 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)); $handle = @fopen(self::$logFile, 'a'); |