MediaWiki-Docker/Configuration recipes/Logging

From mediawiki.org
Jump to navigation Jump to search

Log to STDERR[edit]

With this configuration, you can view MediaWiki's logs by running docker-compose logs -f web, or docker-compose logs -f web | grep '\[error\]' to view only error messages.

if ( !defined( 'STDERR' ) ) {
	define( 'STDERR', fopen( 'php://stderr', 'w' ) );
}

if ( !isset( $maintClass ) || ( isset( $maintClass ) && $maintClass !== 'PHPUnitMaintClass' ) ) {
	$wgMWLoggerDefaultSpi = [
		'class' => \MediaWiki\Logger\ConsoleSpi::class,
	];
}