The current implementation of the MediaWiki\Logger\MonologSpi does not provide a mechanism for altering the configuration data or underlying Monolog system after the initial creation of the object. This makes runtime conditional logging changes essentially impossible.
Currently there have been two use cases identified where this behavior would be useful in the WMF production cluster:
- Historically it has been useful to debug Wikitech LDAP issues with local file logging on the Wikitech server. Thus far we have not been able to devise a method of adding to the Monolog configuration to allow this.
- Sending metrics to statsd to track time rate of change for interesting events could be implemented by adding structured logging in appropriate places to the codebase and attaching a custom Monolog Handler to the appropriate logging channels. For installations not wishing to use Monolog and/or statsd these events would still be available to the logging layer for recording in a file or other data sink.