Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix(log): Only log client request id if present, and at the end
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc committed May 13, 2025
commit 2b4bfcc21280b6c2bbc7e8d2d4c4b766b4d344e3
6 changes: 4 additions & 2 deletions lib/private/Log/LogDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ public function logDetails(string $app, $message, int $level): array {
$userAgent = '--';
}
$version = $this->config->getValue('version', '');
$clientReqId = $request->getHeader('X-Request-Id');
$entry = compact(
'reqId',
'clientReqId',
'level',
'time',
'remoteAddr',
Expand All @@ -61,6 +59,10 @@ public function logDetails(string $app, $message, int $level): array {
'userAgent',
'version'
);
$clientReqId = $request->getHeader('X-Request-Id');
if ($clientReqId !== '') {
$entry['clientReqId'] = $clientReqId;
}

if (is_array($message)) {
// Exception messages are extracted and the exception is put into a separate field
Expand Down
Loading