This is a followup to T107827. Now that we know we're missing logs, find a way to get these messages to log to syslog and appear in payments.error. This probably needs to be done in MediaWiki core, either configuration or a patch to add configuration.
mw-core is catching our fatal error and logging it to the wfDebug stream. Not cool.
== Outcome ==
* Add config block to the beginning of LocalSettings.php, before any require statements.
* Require monolog from composer, being careful to match the version in DI.
```
$defaultProcessors = array(
'wiki' => array(
'class' => 'MediaWiki\Logger\Monolog\WikiProcessor',
),
'psr' => array(
'class' => 'Monolog\Processor\PsrLogMessageProcessor',
),
'pid' => array(
'class' => 'Monolog\Processor\ProcessIdProcessor',
),
'uid' => array(
'class' => 'Monolog\Processor\UidProcessor',
),
'web' => array(
'class' => 'Monolog\Processor\WebProcessor',
),
);
$syslogLogger = array(
'handlers' => array( 'syslog' ),
'processors' => array_keys( $defaultProcessors ),
);
$wgMWLoggerDefaultSpi = array(
'class' => 'MediaWiki\Logger\MonologSpi',
'args' => array( array(
'formatters' => array(
'line' => array(
'class' => 'Monolog\Formatter\LineFormatter',
'args' => array( '%message%' ),
),
),
'handlers' => array(
'syslog' => array(
'class' => 'MediaWiki\Logger\Monolog\SyslogHandler',
'args' => array( 'mediawiki', 'localhost', 514, LOG_USER,
// Although we only publish messages from the error streams,
// note that anything published by wfDebugLog is at the
// info level, thus the low bar.
Monolog\Logger::INFO,
),
'formatter' => 'line',
),
'blackhole' => array(
'class' => 'Monolog\Handler\NullHandler',
),
),
'loggers' => array(
'error' => $syslogLogger,
'exception' => $syslogLogger,
// Throw out anything else. Payments logging is already its
// own thing, so this only includes MediaWiki logs, below error
// level.
'@default' => array( 'handlers' => array( 'blackhole' ) ),
),
'processors' => $defaultProcessors,
), ),
);
```