]> git.mxchange.org Git - friendica.git/commitdiff
Set Timezone to 'UTC' for every Logger (Develop)
authorPhilipp Holzer <admin@philipp.info>
Sat, 9 Mar 2019 13:36:32 +0000 (14:36 +0100)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 23 Mar 2019 03:14:48 +0000 (23:14 -0400)
src/Factory/LoggerFactory.php
src/Util/Logger/StreamLogger.php

index 32a338fb0bd8b2da4d0291c4eaeb8a431462534b..7bb4e3215d25ad455a31f6707e578697f397c713 100644 (file)
@@ -135,6 +135,9 @@ class LoggerFactory
                switch ($config->get('system', 'logger_config', 'stream')) {
 
                        case 'monolog':
+                               $loggerTimeZone = new \DateTimeZone('UTC');
+                               Monolog\Logger::setTimezone($loggerTimeZone);
+
                                $logger = new Monolog\Logger($channel);
                                $logger->pushProcessor(new Monolog\Processor\PsrLogMessageProcessor());
                                $logger->pushProcessor(new Monolog\Processor\ProcessIdProcessor());
index 701d36d2b35c68d1655b4de86a2408f1ee84b3cf..3031461061f3a20299d6f1204210bfc18317a92b 100644 (file)
@@ -134,7 +134,7 @@ class StreamLogger extends AbstractLogger
                $record = array_merge($record, ['uid' => $this->logUid, 'process_id' => $this->pid]);
                $logMessage = '';
 
-               $logMessage .= DateTimeFormat::localNow() . ' ';
+               $logMessage .= DateTimeFormat::utcNow() . ' ';
                $logMessage .= $this->channel . ' ';
                $logMessage .= '[' . strtoupper($level) . ']: ';
                $logMessage .= $this->psrInterpolate($message, $context) . ' ';