Merge pull request #23464 from owncloud/stable9-backport-23443
[stable9] Log more information by default
This commit is contained in:
commit
0009bf244b
|
@ -88,14 +88,25 @@ class OC_Log_Owncloud {
|
||||||
$remoteAddr = $request->getRemoteAddress();
|
$remoteAddr = $request->getRemoteAddress();
|
||||||
// remove username/passwords from URLs before writing the to the log file
|
// remove username/passwords from URLs before writing the to the log file
|
||||||
$time = $time->format($format);
|
$time = $time->format($format);
|
||||||
$minLevel=min($config->getValue( "loglevel", \OCP\Util::WARN ), \OCP\Util::ERROR);
|
$url = ($request->getRequestUri() !== '') ? $request->getRequestUri() : '--';
|
||||||
if($minLevel == \OCP\Util::DEBUG) {
|
$method = is_string($request->getMethod()) ? $request->getMethod() : '--';
|
||||||
$url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '--';
|
if(\OC::$server->getConfig()->getSystemValue('installed', false)) {
|
||||||
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '--';
|
$userObj = \OC::$server->getUserSession()->getUser();
|
||||||
$entry = compact('reqId', 'remoteAddr', 'app', 'message', 'level', 'time', 'method', 'url');
|
|
||||||
} else {
|
} else {
|
||||||
$entry = compact('reqId', 'remoteAddr', 'app', 'message', 'level', 'time');
|
$userObj = null;
|
||||||
}
|
}
|
||||||
|
$user = !is_null($userObj) ? $userObj->getUID() : '--';
|
||||||
|
$entry = compact(
|
||||||
|
'reqId',
|
||||||
|
'remoteAddr',
|
||||||
|
'app',
|
||||||
|
'message',
|
||||||
|
'level',
|
||||||
|
'time',
|
||||||
|
'method',
|
||||||
|
'url',
|
||||||
|
'user'
|
||||||
|
);
|
||||||
$entry = json_encode($entry);
|
$entry = json_encode($entry);
|
||||||
$handle = @fopen(self::$logFile, 'a');
|
$handle = @fopen(self::$logFile, 'a');
|
||||||
@chmod(self::$logFile, 0640);
|
@chmod(self::$logFile, 0640);
|
||||||
|
|
Loading…
Reference in New Issue