jenkins-bot has submitted this change and it was merged. Change subject: Log errors in Http::request() ......................................................................
Log errors in Http::request() Instead of silently discarding errors in server-side HTTP requests, log them to a 'http' channel. Make ForeignAPIFile::httpGet() (which sort of reimplements Http::get()) log to the same channel, for consistency. Bug: T103043 Change-Id: Ibf552e22adc7fde4a751f92e92dad6ceba2f335c (cherry picked from commit 64446397925576210c50baedc77becb470df84e2) --- M includes/HttpFunctions.php M includes/filerepo/ForeignAPIRepo.php 2 files changed, 11 insertions(+), 2 deletions(-) Approvals: BryanDavis: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 556871a..32be935 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -25,6 +25,8 @@ * @defgroup HTTP HTTP */ +use MediaWiki\Logger\LoggerFactory; + /** * Various HTTP related functions * @ingroup HTTP @@ -75,7 +77,11 @@ $content = false; if ( $status->isOK() ) { - $content = $req->getContent(); + $content = $req->getContent(); + } else { + $errors = $status->getErrorsByType( 'error' ); + $logger = LoggerFactory::getInstance( 'http' ); + $logger->warning( $status->getWikiText(), array( 'caller' => $caller ) ); } wfProfileOut( __METHOD__ . "-$method" ); return $content; diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index 695f706..761fb72 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -21,6 +21,8 @@ * @ingroup FileRepo */ +use MediaWiki\Logger\LoggerFactory; + /** * A foreign repository with a remote MediaWiki with an API thingy * @@ -521,7 +523,8 @@ if ( $status->isOK() ) { return $req->getContent(); } else { - wfDebug( "ForeignAPIRepo: ERROR on GET: " . $status->getWikiText() ); + $logger = LoggerFactory::getInstance( 'http' ); + $logger->warning( $status->getWikiText(), array( 'caller' => 'ForeignAPIRepo::httpGet' ) ); return false; } } -- To view, visit https://gerrit.wikimedia.org/r/237533 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibf552e22adc7fde4a751f92e92dad6ceba2f335c Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: REL1_23 Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org> Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits