Problem
The PSR3 logging interface has been introduced in MediaWiki to support structured logging, but no coordinated effort has been made to deprecate the use of wfDebug(), wfDebugLog(), wfLogDBError(), and wfErrorLog(). Several bugs are open in the MediaWiki-Debug-Logger project about the lack of parity between debug log usability on the Wikimedia Foundation production cluster and a typical development environment or external deployment of MediaWiki that are directly related to @bd808 taking the structured logging project to a point where it is useful for the WMF but not pushing that usability further for other MediaWiki deployments.
Who would benefit
- MediaWiki site operators who want better insight into their operational issues
- MediaWiki developers who don't want to think about choosing between two largely compatible but very different debug logging layers
Proposed solution
- Replace all usage of wfDebug* in MediaWiki core with direct PSR3 usage.
- Add Monolog as a core dependency and the default debug logging solution.
- Make configuring Monolog easier by making helpers in the MediaWiki\Logger\Monolog namespace.
- Remove MediaWiki\Logger\LegacyLogger from core. (It could be made a library if there are people who really love it and want to keep maintaining a homegrown debug log formatting and routing layer.)
- Deprecate wfDebug(), wfDebugLog(), wfLogDBError(), and wfErrorLog().
See also
- T88649: Convert MediaWiki logging to direct use of PSR-3
- T128224: It is difficult to determine in which log bucket a logging call will end up
- T92585: MediaWiki logging/debugging documentation is out of date
- T108650: $wgMWLoggerDefaultSpi requires special usage, needs to be fixed or documented
- T142313: Add global information to debug logger context
- T114532: MWDebug toolbar log is empty when Monolog is enabled