Merge pull request #1647 from nextcloud/stable9-backport-1562

[stable9] log version number in each log line
This commit is contained in:
Morris Jobke 2016-10-10 08:30:26 +02:00 committed by GitHub
commit 2f546eab71
1 changed files with 4 additions and 2 deletions

View File

@ -91,11 +91,12 @@ class OC_Log_Owncloud {
$time = $time->format($format); $time = $time->format($format);
$url = ($request->getRequestUri() !== '') ? $request->getRequestUri() : '--'; $url = ($request->getRequestUri() !== '') ? $request->getRequestUri() : '--';
$method = is_string($request->getMethod()) ? $request->getMethod() : '--'; $method = is_string($request->getMethod()) ? $request->getMethod() : '--';
if(\OC::$server->getConfig()->getSystemValue('installed', false)) { if($config->getValue('installed', false)) {
$user = (\OC_User::getUser()) ? \OC_User::getUser() : '--'; $user = (\OC_User::getUser()) ? \OC_User::getUser() : '--';
} else { } else {
$user = '--'; $user = '--';
} }
$version = $config->getValue('version', '');
$entry = compact( $entry = compact(
'reqId', 'reqId',
'remoteAddr', 'remoteAddr',
@ -105,7 +106,8 @@ class OC_Log_Owncloud {
'time', 'time',
'method', 'method',
'url', 'url',
'user' 'user',
'version'
); );
$entry = json_encode($entry); $entry = json_encode($entry);
$handle = @fopen(self::$logFile, 'a'); $handle = @fopen(self::$logFile, 'a');