summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-03-14 17:08:48 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-03-14 17:08:48 +0100
commita058bb0d7ed7b26634445f5b7d17ba2fa25f0c20 (patch)
treed9377f48d5a7021cad22559c09a2e887f3b72d73 /lib
parentb25077748e98fbfd59be24beccc96386d8903826 (diff)
parent3e7b2810e21879fbd3c7c28c53cc7cf2407a13c0 (diff)
downloadnextcloud-server-a058bb0d7ed7b26634445f5b7d17ba2fa25f0c20.tar.gz
nextcloud-server-a058bb0d7ed7b26634445f5b7d17ba2fa25f0c20.zip
Merge pull request #23225 from owncloud/Phiber2000-fix_logtimezone
fix broken logtimezone
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 5a48f9e1c6d..6399d7ee588 100644
--- a/lib/private/log/owncloud.php
+++ b/lib/private/log/owncloud.php
@@ -76,9 +76,12 @@ class OC_Log_Owncloud {
} catch (Exception $e) {
$timezone = new DateTimeZone('UTC');
}
- $time = DateTime::createFromFormat("U.u", number_format(microtime(true), 4, ".", ""), $timezone);
+ $time = DateTime::createFromFormat("U.u", number_format(microtime(true), 4, ".", ""));
if ($time === false) {
$time = new DateTime(null, $timezone);
+ } else {
+ // apply timezone if $time is created from UNIX timestamp
+ $time->setTimezone($timezone);
}
$request = \OC::$server->getRequest();
$reqId = $request->getId();
@@ -90,8 +93,7 @@ class OC_Log_Owncloud {
$url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '--';
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '--';
$entry = compact('reqId', 'remoteAddr', 'app', 'message', 'level', 'time', 'method', 'url');
- }
- else {
+ } else {
$entry = compact('reqId', 'remoteAddr', 'app', 'message', 'level', 'time');
}
$entry = json_encode($entry);