Merge pull request #3321 from nextcloud/revert-unintentional-change-of-log-timestamp-format

Revert unintentional log timestamp format change
This commit is contained in:
Morris Jobke 2017-01-31 08:44:06 -06:00 committed by GitHub
commit db5af891c3
3 changed files with 5 additions and 6 deletions

View File

@ -716,9 +716,8 @@ $CONFIG = array(
/**
* This uses PHP.date formatting; see http://php.net/manual/en/function.date.php
*
* Defaults to ``Y-m-d\TH:i:sP`` (ISO8601 but with colon between hours and
* minutes of the timezone) - see \DateTime::ISO8601
* (https://secure.php.net/manual/en/class.datetime.php#datetime.constants.iso8601)
* Defaults to ISO 8601 ``2005-08-15T15:52:01+00:00`` - see \DateTime::ATOM
* (https://secure.php.net/manual/en/class.datetime.php#datetime.constants.atom)
*/
'logdateformat' => 'F d, Y H:i:s',

View File

@ -97,11 +97,11 @@ class TimestampFormatter implements OutputFormatterInterface {
*/
public function format($message) {
$timeZone = $this->config->getSystemValue('logtimezone', null);
$timeZone = $this->config->getSystemValue('logtimezone', 'UTC');
$timeZone = $timeZone !== null ? new \DateTimeZone($timeZone) : null;
$time = new \DateTime('now', $timeZone);
$timestampInfo = $time->format($this->config->getSystemValue('logdateformat', \DateTime::ISO8601));
$timestampInfo = $time->format($this->config->getSystemValue('logdateformat', \DateTime::ATOM));
return $timestampInfo . ' ' . $this->formatter->format($message);
}

View File

@ -75,7 +75,7 @@ class File {
$config = \OC::$server->getSystemConfig();
// default to ISO8601
$format = $config->getValue('logdateformat', \DateTime::ISO8601);
$format = $config->getValue('logdateformat', \DateTime::ATOM);
$logTimeZone = $config->getValue('logtimezone', 'UTC');
try {
$timezone = new \DateTimeZone($logTimeZone);