Skip to content
Snippets Groups Projects
Commit b4df4cc6 authored by Björn Schießle's avatar Björn Schießle
Browse files

Merge pull request #5219 from owncloud/catch_wrong_timezone

catch unknown timezone and fall-back to UTC
parents a18ebac1 c1e5725d
Branches
No related tags found
No related merge requests found
......@@ -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');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment