Avoid 'message' in log context in AuthManager
authorGergő Tisza <gtisza@wikimedia.org>
Sat, 1 Oct 2016 01:10:56 +0000 (01:10 +0000)
committerGergő Tisza <gtisza@wikimedia.org>
Tue, 4 Oct 2016 00:24:42 +0000 (00:24 +0000)
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
tests/phpunit/includes/auth/AuthManagerTest.php

index 51efe56..e223e16 100644 (file)
@@ -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();
index f679f63..dc6fc62 100644 (file)
@@ -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' ) );