手册:$wgDebugLogGroups
Appearance
调试: $wgDebugLogGroups | |
---|---|
将某些组的wfDebugLog() 输出直接输出到$wgDebugLogFile 以外的文件。 |
|
引进版本: | 1.5.0 (r10598) |
移除版本: | 仍在使用 |
允许的值: | (由日志组为键文件名为值组成的数组) |
默认值: | [] |
其他设置: 按首字母排序 | 按功能排序 |
详情
设置一个数组,日志组为键文件名为值。
如果设置,该日志组的wfDebugLog()
输出将转到设置的文件里而不是常规的$wgDebugLogFile
。
对生产环境下选择性日志非常有用。
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.日志目标可以是以下之一:
- 设置为false将完全禁用日志输出,包括$wgDebugLogFile。
- 设置字符串类型的值将认定为文件名或者URL。
- 设置一个带键的关联数组:
destination
- 所需的文件名或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
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
exception
,error
,fatal
- errorsdeprecated
- deprecation warningsobjectcache
,caches
,memcached
/SQLBagOStuff
- 缓存rdbms
- 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
- 手册:作业队列parser
,ParserCache
- Parserslow-parse
- warnings about pages that take long to parse
Other debug log groups
squid
localisation
gitinfo
UserOptionsManager
Mime
OldRevisionImporter
MessageCache
GlobalTitleFail
DeferredUpdates
ContentHandler
BlockManager
MediaHandlerFactory