Manual:$wgDebugLogGroups: Difference between revisions
Appearance
Content deleted Content added
translation tweaks |
mNo edit summary |
||
(32 intermediate revisions by 12 users not shown) | |||
Line 1: | Line 1: | ||
<languages/> |
<languages /> |
||
{{ |
{{SettingSummary |
||
|name=DebugLogGroups |
|name=DebugLogGroups |
||
|version_min=1.5.0 |
|version_min=1.5.0 |
||
|rev_introduced=10598 |
|rev_introduced=10598 |
||
|section=Debug/logging |
|section=Debug/logging |
||
|range=<translate><!--T:1--> array of log group keys to filenames</translate> |
|range=(<translate><!--T:1--> array of log group keys to filenames</translate>) |
||
|default= |
|default=<code>[]</code> |
||
|summary=<translate><!--T:2--> Direct <tvar |
|summary=<translate><!--T:2--> Direct <tvar name=1><code>wfDebugLog()</code></tvar> output for certain groups to files other than <tvar name=2><code>{{ll|Manual:$wgDebugLogFile|$wgDebugLogFile}}</code></tvar>.</translate> |
||
}} |
}} |
||
<translate> |
<translate> |
||
== Details == <!--T:3--> |
== Details == <!--T:3--> |
||
⚫ | |||
⚫ | |||
⚫ | |||
<!--T:5--> |
|||
⚫ | |||
⚫ | |||
<!--T:6--> |
|||
⚫ | |||
</translate> |
</translate> |
||
⚫ | |||
⚫ | |||
⚫ | |||
{{Note|1=<translate><!--T:9--> If a group is configured in <tvar |
{{Note|1=<translate><!--T:9--> If a group is configured in <tvar name=1><code>$wgDebugLogGroups</code></tvar>, then all debug messages with the according group key will be logged to that file, ''also'' if <tvar name=2><code>$wgDebugLogFile</code></tvar> is '''not''' set!</translate> <translate><!--T:10--> With other words: If a group key is configured in <tvar name=1><code>$wgDebugLogGroups</code></tvar>, messages will be written, even if an empty value of <tvar name=2><code>$wgDebugLogFile</code></tvar> generally disables debugging.</translate>}} |
||
<translate> |
<translate> |
||
Line 29: | Line 23: | ||
<!--T:12--> |
<!--T:12--> |
||
* false to completely remove from the output, including from $wgDebugLogFile.</translate> |
* false to completely remove from the output, including from <tvar name=1>$wgDebugLogFile</tvar>.</translate> |
||
<translate> |
<translate> |
||
<!--T:13--> |
<!--T:13--> |
||
Line 36: | Line 30: | ||
<!--T:14--> |
<!--T:14--> |
||
* associative array with keys:</translate> |
* associative array with keys:</translate> |
||
⚫ | |||
⚫ | |||
⚫ | |||
<!--T:15--> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
<!--T:16--> |
|||
⚫ | |||
⚫ | |||
<!--T:17--> |
|||
⚫ | |||
⚫ | |||
<!--T:18--> |
<!--T:18--> |
||
When <tvar |
When <tvar name=1><code>{{ll|Manual:$wgMWLoggerDefaultSpi|$wgMWLoggerDefaultSpi}}</code></tvar> is set to a non-default value, <tvar name=2><code>$wgDebugLogGroups</code></tvar> will probably be ignored, and the method of configuring log files will be determined by whatever logging system is invoked by <tvar name=3><code>$wgMWLoggerDefaultSpi</code></tvar>. |
||
== Example == <!--T:7--> |
== Example == <!--T:7--> |
||
</translate> |
|||
<translate> |
|||
<!--T:8--> |
<!--T:8--> |
||
This example logs debug messages of group "ConfirmEditExtension" to "debug-ext_confirmedit.log" and those of group "SpamRegex" to "debug-spam.log". |
This example logs debug messages of group "<tvar name=1>ConfirmEditExtension</tvar>" to "<tvar name=2>debug-ext_confirmedit.log</tvar>" and those of group "<tvar name=3>SpamRegex</tvar>" to "<tvar name=4>debug-spam.log</tvar>". |
||
</translate> |
</translate> |
||
<syntaxhighlight lang="php"> |
<syntaxhighlight lang="php"> |
||
$wgDebugLogGroups = |
$wgDebugLogGroups = [ |
||
'ConfirmEditExtension' => $IP . '/../../home/debug-ext_confirmedit.log', |
'ConfirmEditExtension' => $IP . '/../../home/debug-ext_confirmedit.log', |
||
'SpamRegex' => $IP . '/../../home/debug-spam.log', |
'SpamRegex' => $IP . '/../../home/debug-spam.log', |
||
]; |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
Line 79: | Line 66: | ||
<syntaxhighlight lang="php"> |
<syntaxhighlight lang="php"> |
||
$wgDebugLogGroups['memcached'] = |
$wgDebugLogGroups['memcached'] = [ |
||
'destination' => '/var/log/mediawiki/memcached.log', |
'destination' => '/var/log/mediawiki/memcached.log', |
||
'sample' => 1000, // <translate><!--T:21--> log 1 message out of every 1,000.</translate> |
'sample' => 1000, // <translate nowrap><!--T:21--> log 1 message out of every 1,000.</translate> |
||
'level' => \Psr\Log\LogLevel::WARNING, |
'level' => \Psr\Log\LogLevel::WARNING, |
||
]; |
|||
$wgDebugLogGroups['redis'] = |
$wgDebugLogGroups['redis'] = [ |
||
'destination' => '/var/log/mediawiki/redis.log', |
'destination' => '/var/log/mediawiki/redis.log', |
||
// <translate><!--T:22--> Level can also be the literal string value of any Psr\Log\LogLevel constant</translate> |
// <translate nowrap><!--T:22--> Level can also be the literal string value of any Psr\Log\LogLevel constant</translate> |
||
'level' => 'info', |
'level' => 'info', |
||
]; |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
⚫ | |||
⚫ | |||
⚫ | |||
; Multiple log groups in a single file: |
|||
: You might want to setup a temporary configuration like the following to see all authentication related logging to trouble-shoot authentication. |
|||
⚫ | |||
<syntaxhighlight lang="php"> |
|||
$wgDebugLogGroups['cookie'] = |
|||
$wgDebugLogGroups['session'] = |
|||
$wgDebugLogGroups['SimpleSAMLphp'] = |
|||
$wgDebugLogGroups['PluggableAuth'] = "$IP/cache/PluggableAuth.log"; |
|||
</syntaxhighlight> |
|||
⚫ | |||
== Some common debug log groups == <!--T:26--> |
|||
⚫ | |||
* <code>exception</code>, <code>error</code>, <code>fatal</code> - <translate><!--T:27--> errors</translate> |
|||
* <code>deprecated</code> - <translate><!--T:28--> deprecation warnings</translate> |
|||
* <code>objectcache</code>, <code>caches</code>, <code>memcached</code>/<code>SQLBagOStuff</code> - {{ll|Manual:$wgObjectCaches|2=<translate><!--T:24--> cache</translate>}} |
|||
* <code>rdbms</code> - <translate><!--T:29--> database</translate> (including, if {{ll|Manual:$wgDebugDumpSql|$wgDebugDumpSql}} is set, all DB queries) |
|||
* <code>cookie</code> - <translate><!--T:31--> response cookies</translate> |
|||
* <code>exec</code> - <translate><!--T:32--> shell commands</translate> |
|||
* <code>session</code> - {{ll|Manual:SessionManager|SessionManager}} |
|||
* <code>authentication</code>, <code>login</code> - {{ll|Manual:AuthManager|AuthManager}} |
|||
* <code>ratelimit</code>, <code>throttler</code> - <translate><!--T:33--> hitting rate limits (<tvar name=1>{{ll|Manual:$wgRateLimits|$wgRateLimits}}</tvar> and other)</translate> |
|||
* <code>resourceloader</code>, <code>ResourceLoaderImage</code> - [[ResourceLoader]] |
|||
* <code>http</code>, <code>HttpError</code> - <translate><!--T:34--> HTTP requests to external services (via the <tvar name=1><code>Http</code>/<code>MwHttpRequest</code></tvar> classes)</translate> |
|||
* <code>api</code> - {{ll|API:Main page|2=<translate><!--T:25--> API</translate>}} |
|||
* <code>thumbnail</code>, <code>fileupload</code>, <code>fileconcatenate</code> - <translate><!--T:35--> image-related</translate> |
|||
* <code>runJobs</code> - {{ll|Manual:Job queue|nsp=0}} |
|||
* <code>parser</code>, <code>ParserCache</code> - {{ll|Manual:Parser|nsp=0}} |
|||
* <code>slow-parse</code> - <translate><!--T:36--> warnings about pages that take long to parse</translate> |
|||
⚫ |
Latest revision as of 00:03, 27 December 2023
Debug: $wgDebugLogGroups | |
---|---|
Direct wfDebugLog() output for certain groups to files other than $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: | [] |
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 $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 log level (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 = [
'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'] = [
'destination' => '/var/log/mediawiki/memcached.log',
'sample' => 1000, // log 1 message out of every 1,000.
'level' => \Psr\Log\LogLevel::WARNING,
];
$wgDebugLogGroups['redis'] = [
'destination' => '/var/log/mediawiki/redis.log',
// Level can also be the literal string value of any Psr\Log\LogLevel constant
'level' => 'info',
];
- Multiple log groups in a single file
- You might want to setup a temporary configuration like the following to see all authentication related logging to trouble-shoot authentication.
$wgDebugLogGroups['cookie'] =
$wgDebugLogGroups['session'] =
$wgDebugLogGroups['SimpleSAMLphp'] =
$wgDebugLogGroups['PluggableAuth'] = "$IP/cache/PluggableAuth.log";
Some common debug log groups
[edit]exception
,error
,fatal
- errorsdeprecated
- deprecation warningsobjectcache
,caches
,memcached
/SQLBagOStuff
- cacherdbms
- database (including, if $wgDebugDumpSql is set, all DB queries)cookie
- response cookiesexec
- shell commandssession
- SessionManagerauthentication
,login
- AuthManagerratelimit
,throttler
- hitting rate limits ($wgRateLimits and other)resourceloader
,ResourceLoaderImage
- ResourceLoaderhttp
,HttpError
- HTTP requests to external services (via theHttp
/MwHttpRequest
classes)api
- APIthumbnail
,fileupload
,fileconcatenate
- image-relatedrunJobs
- Job queueparser
,ParserCache
- Parserslow-parse
- warnings about pages that take long to parse