diff options
author | Timo Tijhof <krinkle@fastmail.com> | 2022-10-15 21:16:07 +0100 |
---|---|---|
committer | Krinkle <krinkle@fastmail.com> | 2023-01-03 22:46:38 +0000 |
commit | 4ef0891994a76de2c3c32cc8ea22fca7a8644372 (patch) | |
tree | 7ef98c5f617a6b475155c1b1ef809842401d32fa /includes/db/MWLBFactory.php | |
parent | 9afab251cac5b02564a68c13f25418c522df9467 (diff) | |
download | mediawikicore-4ef0891994a76de2c3c32cc8ea22fca7a8644372.tar.gz mediawikicore-4ef0891994a76de2c3c32cc8ea22fca7a8644372.zip |
rdbms: Consolidate logger channels into one
Notable changes:
* In SqlBagOStuff::getConnectionFromServerInfo, only two loggers were
injected. The rest implicitly got a NullLogger due to being absent.
These are now effectively unsilenced.
* Database::__construct() required almost all parameters, even the
loggers. I've wanted to move some of DatabaseFactory into the ctor
here for a while. In order to make this change not a breaking
change, the new 'logger' parameter is optional with NullLogger as
default. This allowed some of the test cases, which were simply
passing NullLogger, to be fixed by passing nothing instead of
passing the new option name.
The Database class is behind a dozen layers of indirection for
real use, so this will still be injected just fine (DBF, LB, LBF,
MWLBF, etc.).
* In LegacyLogger, the handling for $wgDBerrorLog was previously
limited to DBConnection and DBQuery. This now includes errors
from other (generally, newer) parts of Rdbms as well, which were
previously missing.
This only affects sites (typically CI and dev setup) where
$wgDBerrorLog is used, as opposed to the more common
$wgDebugLogGroups by-channel configuration.
* TransactionProfiler gets its logger injected in a rather odd way,
via entrypoints (MediaWiki.php, ApiMain.php, and MaintenanceRunner)
as opposed to service wiring. This is kept as-is for now.
* In LBFactoryTest, in particular testInvalidSelectDBIndependent2,
there are cases that intentionally produce failures of which
the result is then observed. In CI we assert that dberror.log is
empty so instead of adding the missing logger fields to that
LBFactory instance, the only one set (replLogger) is removed.
The alternative is to set 'logger' now, which would naturally
cause CI failures due to unexpected entries coming through to
non-mocked error log.
Bug: T320873
Change-Id: I7ca996618e41b93f488cb5c4de82000bb36e0dd3
Diffstat (limited to 'includes/db/MWLBFactory.php')
-rw-r--r-- | includes/db/MWLBFactory.php | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/includes/db/MWLBFactory.php b/includes/db/MWLBFactory.php index 3b62bde76f14..983cfac3b007 100644 --- a/includes/db/MWLBFactory.php +++ b/includes/db/MWLBFactory.php @@ -151,10 +151,7 @@ class MWLBFactory { return Profiler::instance()->scopedProfileIn( $section ); }, 'trxProfiler' => Profiler::instance()->getTransactionProfiler(), - 'replLogger' => LoggerFactory::getInstance( 'DBReplication' ), - 'queryLogger' => LoggerFactory::getInstance( 'DBQuery' ), - 'connLogger' => LoggerFactory::getInstance( 'DBConnection' ), - 'perfLogger' => LoggerFactory::getInstance( 'DBPerformance' ), + 'logger' => LoggerFactory::getInstance( 'rdbms' ), 'errorLogger' => [ MWExceptionHandler::class, 'logException' ], 'deprecationLogger' => [ static::class, 'logDeprecation' ], 'statsdDataFactory' => $this->statsdDataFactory, |