Skip to content

Commit 6d8d232

Browse files
committed
fix(log): Only log client request id if present, and at the end
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent fb80068 commit 6d8d232

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/private/Log/LogDetails.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ public function logDetails(string $app, $message, int $level): array {
4646
$userAgent = '--';
4747
}
4848
$version = $this->config->getValue('version', '');
49-
$clientReqId = $request->getHeader('X-Request-Id');
5049
$entry = compact(
5150
'reqId',
52-
'clientReqId',
5351
'level',
5452
'time',
5553
'remoteAddr',
@@ -61,6 +59,10 @@ public function logDetails(string $app, $message, int $level): array {
6159
'userAgent',
6260
'version'
6361
);
62+
$clientReqId = $request->getHeader('X-Request-Id');
63+
if ($clientReqId !== '') {
64+
$entry['clientReqId'] = $clientReqId;
65+
}
6466

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

0 commit comments

Comments
 (0)