本文介绍了Log4Net配置日志级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使 Log4net 仅记录信息级别的日志?那有可能吗?您只能设置一个阈值吗?
How do I make Log4net only log Info level logs? Is that even possible? Can you only set a threshold?
这就是我所拥有的,并且它记录了Info和以上的信息,正如我期望的那样.我有什么办法可以使其仅记录日志信息?
This is what I have, and it logs Info and above as I would expect. Is there anything i can do to make it only log info?
<logger name="BrokerCollection.Model.XmlDocumentCreationTask">
<appender-ref ref="SubmissionAppender"/>
<level value="Info" />
</logger>
推荐答案
在附加程序的定义中,我相信您可以执行以下操作:
Within the definition of the appender, I believe you can do something like this:
<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="INFO"/>
<param name="LevelMax" value="INFO"/>
</filter>
...
</appender>
这篇关于Log4Net配置日志级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!