From cdcc2a0e3f18718f56c1da37dac7b399bf3add70 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerg=C5=91=20Tisza?= Date: Sat, 1 Oct 2016 01:10:56 +0000 Subject: [PATCH] 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 --- includes/auth/AuthManager.php | 4 ++-- tests/phpunit/includes/auth/AuthManagerTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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' ) ); -- 2.20.1