From f7ee7dc807406802044ba791f5303edf6355c519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Mon, 21 Oct 2019 16:38:23 +0200 Subject: [PATCH] Try using structured logging again The configuration of Wikimedia wikis should be fixed. This reverts commit 04407e9eb102714d00e2a41ce853a1902c640039 and also makes similar changes to new logging code added in 5d1a67757a2dec81d7199ba9a2575015b39acf95. Bug: T234564 Change-Id: Ic999b050e68b71f5a1737366e16f133e5a557307 --- includes/ApiVisualEditor.php | 20 +++++++++++++------- includes/ApiVisualEditorEdit.php | 6 +++++- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/includes/ApiVisualEditor.php b/includes/ApiVisualEditor.php index 822fc91772..8bd6be53fb 100644 --- a/includes/ApiVisualEditor.php +++ b/includes/ApiVisualEditor.php @@ -134,13 +134,15 @@ class ApiVisualEditor extends ApiBase { ); } else { // error null, code not 200 - $trace = ( new Exception )->getTraceAsString(); $this->logger->warning( - __METHOD__ . ": Received HTTP {$response['code']} from RESTBase for $path." . - " Trace: {$trace}" . - " Response: {$response['body']}" . - /** @phan-suppress-next-line PhanTypeInvalidDimOffset */ - " Request If-Match: {$reqheaders['If-Match']}" + __METHOD__ . ": Received HTTP {code} from RESTBase", + [ + 'code' => $response['code'], + 'trace' => ( new Exception )->getTraceAsString(), + 'response' => $response['body'], + 'requestPath' => $path, + 'requestIfMatch' => $reqheaders['If-Match'] ?? '', + ] ); $this->dieWithError( [ 'apierror-visualeditor-docserver-http', $response['code'] ], @@ -634,7 +636,11 @@ class ApiVisualEditor extends ApiBase { $badetag = $params['badetag']; $goodetag = $result['etag'] ?? ''; $this->logger->info( - __METHOD__ . ": Client reported bad ETag: $badetag, expected: $goodetag" + __METHOD__ . ": Client reported bad ETag: {badetag}, expected: {goodetag}", + [ + 'badetag' => $badetag, + 'goodetag' => $goodetag, + ] ); } if ( $params['paction'] === 'parse' || diff --git a/includes/ApiVisualEditorEdit.php b/includes/ApiVisualEditorEdit.php index 547aceaf29..a9d8503baf 100644 --- a/includes/ApiVisualEditorEdit.php +++ b/includes/ApiVisualEditorEdit.php @@ -288,7 +288,11 @@ class ApiVisualEditorEdit extends ApiVisualEditor { "?$ /x', $etag ) ) { $this->logger->info( - __METHOD__ . ": Received funny ETag from client: $etag for $path" + __METHOD__ . ": Received funny ETag from client: {etag}", + [ + 'etag' => $etag, + 'requestPath' => $path, + ] ); } return $this->requestRestbase(