From: Gergő Tisza Date: Sat, 1 Oct 2016 01:10:56 +0000 (+0000) Subject: Avoid 'message' in log context in AuthManager X-Git-Tag: 1.31.0-rc.0~5221^2 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=cdcc2a0e3f18718f56c1da37dac7b399bf3add70;p=lhc%2Fweb%2Fwiklou.git Avoid 'message' in log context in AuthManager Logstash merges the log context into the main metadata (where 'message' is the log message) and ends up overwriting the message. Bug: T145133 Change-Id: I27f221b0f1f7203e93d1b92119dc584ba8526f5b --- diff --git a/includes/auth/AuthManager.php b/includes/auth/AuthManager.php index 51efe5696a..e223e16e69 100644 --- a/includes/auth/AuthManager.php +++ b/includes/auth/AuthManager.php @@ -1694,9 +1694,9 @@ class AuthManager implements LoggerAwareInterface { $status = Status::newGood(); $status->warning( 'userexists' ); } else { - $this->logger->error( __METHOD__ . ': {username} failed with message {message}', [ + $this->logger->error( __METHOD__ . ': {username} failed with message {msg}', [ 'username' => $username, - 'message' => $status->getWikiText( null, null, 'en' ) + 'msg' => $status->getWikiText( null, null, 'en' ) ] ); $user->setId( 0 ); $user->loadFromId(); diff --git a/tests/phpunit/includes/auth/AuthManagerTest.php b/tests/phpunit/includes/auth/AuthManagerTest.php index f679f63345..dc6fc62c3d 100644 --- a/tests/phpunit/includes/auth/AuthManagerTest.php +++ b/tests/phpunit/includes/auth/AuthManagerTest.php @@ -2674,7 +2674,7 @@ class AuthManagerTest extends \MediaWikiTestCase { $this->assertEquals( 0, $session->getUser()->getId() ); $this->assertSame( [ [ LogLevel::INFO, 'creating new user ({username}) - from: {from}' ], - [ LogLevel::ERROR, '{username} failed with message {message}' ], + [ LogLevel::ERROR, '{username} failed with message {msg}' ], ], $logger->getBuffer() ); $logger->clearBuffer(); $this->assertSame( null, $session->get( 'AuthManager::AutoCreateBlacklist' ) );