From: Philipp Holzer Date: Sat, 9 Mar 2019 13:36:32 +0000 (+0100) Subject: Set Timezone to 'UTC' for every Logger (Develop) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d03dedee639eb02329e164dcf7211da0f5458f10;p=friendica.git Set Timezone to 'UTC' for every Logger (Develop) --- diff --git a/src/Factory/LoggerFactory.php b/src/Factory/LoggerFactory.php index 32a338fb0b..7bb4e3215d 100644 --- a/src/Factory/LoggerFactory.php +++ b/src/Factory/LoggerFactory.php @@ -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()); diff --git a/src/Util/Logger/StreamLogger.php b/src/Util/Logger/StreamLogger.php index 701d36d2b3..3031461061 100644 --- a/src/Util/Logger/StreamLogger.php +++ b/src/Util/Logger/StreamLogger.php @@ -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) . ' ';