使用其他log4net的日志记录级别比一般的人 [英] Using other log4net logging levels than the usual ones
问题描述
我已经意识到,有更多的水平高于一切,调试,信息,警告,错误和致命的,它们被列在 log4net.Core.Level
类。
I've realised that there is more levels than all, debug, info, warn, error and fatal, they are listed in the log4net.Core.Level
class.
但我如何使用它们?我的意思是,在的ILog
界面你,如果你想用很好或紧急,用平常的,但什么方法等等?
But how can I use them? I mean, in the ILog
interface you have methods to use the usual ones, but what if you want to use "Fine" or "Emergency", etc?
干杯。
推荐答案
在下面的例子中登录
的类型是的ILog
。
In the following example Log
is of type ILog
.
Log.Logger.Log(null, log4net.Core.Level.Emergency, "Help!", null);
有关检查每个级别的值
,以便知道他们什么时候会被禁用。
For each level you check their Value
in order to know when they are disabled.
有关的log4net版本1.2.10.0您有以下水平和相关切断值:
For log4net version 1.2.10.0 you have the following levels and associated cut off values:
OFF: 2147483647
EMERGENCY: 120000
FATAL: 110000
ALERT: 100000
CRITICAL: 90000
SEVERE: 80000
ERROR: 70000
WARN: 60000
NOTICE: 50000
INFO: 40000
DEBUG: 30000
FINE: 30000
TRACE: 20000
FINER: 20000
VERBOSE: 10000
FINEST: 10000
ALL: -2147483648
请注意,某些级别共享相同的值,从而禁止他们中的一个还将禁用其他,例如像TRACE和细小。
Note that some levels share the same values so disabling one of them will also disable the other, like for example TRACE and FINER.
这篇关于使用其他log4net的日志记录级别比一般的人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!