Manual:$wgDebugLogGroups

From MediaWiki.org
Jump to: navigation, search

Other languages:
català • ‎Deutsch • ‎English • ‎español • ‎suomi • ‎français • ‎italiano • ‎日本語 • ‎polski • ‎português • ‎português do Brasil
Debug/logging: $wgDebugLogGroups
Direct wfDebugLog() output for certain groups to files other than $wgDebugLogFileManual:$wgDebugLogFile.
Introduced in version: 1.5.0 (r10598)
Removed in version: still in use
Allowed values: array of log group keys to filenames
Default value: array()
Other settings: Alphabetical | By function

Details[edit]

Set to an array of log group keys to filenames. If set, wfDebugLog() output for that group will go to that file instead of the regular $wgDebugLogFileManual:$wgDebugLogFile. Useful for enabling selective logging in production.

If a group is configured in $wgDebugLogGroups, then all debug messages with the according group key will be logged to that file, also if $wgDebugLogFile is not set! With other words: If a group key is configured in $wgDebugLogGroups, messages will be written, even if an empty value of $wgDebugLogFile generally disables debugging.

Log destinations may be one of the following:

  • false to completely remove from the output, including from $wgDebugLogFile.
  • string values specifying a filename or URI.
  • associative array with keys:
    • 'destination' desired filename or URI.
    • 'sample' an integer value, specifying a sampling factor (optional)
    • 'level' A \Psr\Log\LogLevel constant, indicating the minimum level log (optional, since 1.25)

When $wgMWLoggerDefaultSpi is set to a non-default value, $wgDebugLogGroups will probably be ignored, and the method of configuring log files will be determined by whatever logging system is invoked by $wgMWLoggerDefaultSpi.

Example[edit]

This example logs debug messages of group "ConfirmEditExtension" to "debug-ext_confirmedit.log" and those of group "SpamRegex" to "debug-spam.log".

$wgDebugLogGroups = array(
	'ConfirmEditExtension'	=> $IP . '/../../home/debug-ext_confirmedit.log',
	'SpamRegex'		=> $IP . '/../../home/debug-spam.log',
);

Example:

$wgDebugLogGroups['redis'] = '/var/log/mediawiki/redis.log';

Advanced example:

 $wgDebugLogGroups['memcached'] = array(
     'destination' => '/var/log/mediawiki/memcached.log',
     'sample' => 1000,  // log 1 message out of every 1,000.
     'level' => \Psr\Log\LogLevel::WARNING,
 );
 $wgDebugLogGroups['redis'] = array(
     'destination' => '/var/log/mediawiki/redis.log',
     // Level can also be the literal string value of any Psr\Log\LogLevel constant
     'level' => 'info',
 );