我的根记录器捕获所有级别的日志,除了off
. 我的等级设置为INFO
。我搜索了某个地方是否更改了级别,但我一无所获。
当我将记录器IBatisNet.DataMapper.Commands.DefaultPreparedCommand
放到 时DEBUG
,日志是由SpecificAppender
. 但是,即使 root 设置为 ,日志也会出现在控制台中INFO
。
这是我的代码:
<?xml version="1.0" encoding="utf-8" ?>
<!-- This section contains the log4net configuration settings -->
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<!-- Define some output appenders -->
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="d:/logs/vol/vol.log" />
<param name="AppendToFile" value="true" />
<param name="MaxSizeRollBackups" value="3" />
<param name="MaximumFileSize" value="500KB" />
<param name="RollingStyle" value="Size" />
<param name="StaticLogFileName" value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss,fff} [%t] %-5p %c{1} - %m%n" />
</layout>
</appender>
<appender name="IBatisAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="d:/logs/vol/IBatis.log" />
<param name="AppendToFile" value="true" />
<param name="MaxSizeRollBackups" value="3" />
<param name="MaximumFileSize" value="1000KB" />
<param name="RollingStyle" value="Size" />
<param name="StaticLogFileName" value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss,fff} [%t] %-5p %c{1} - %m%n" />
</layout>
</appender>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss,fff} [%t] %-5p %c{1} - %m%n" />
</layout>
</appender>
<appender name="IBatisBufferingAppender" type="log4net.Appender.BufferingForwardingAppender" >
<bufferSize value="60"/>
<appender-ref ref="IBatisAppender" />
</appender>
<appender name="LogBufferingAppender" type="log4net.Appender.BufferingForwardingAppender" >
<bufferSize value="60"/>
<appender-ref ref="RollingLogFileAppender" />
</appender>
<appender name="SpecificAppender" type="log4net.Appender.RollingFileAppender">
<file value="d:/logs/vol/" />
<appendToFile value="true"/>
<datePattern value="Volu\me\trieSpeci\fic_yyyy-MM-dd.lo\g"/>
<rollingStyle value="Date"/>
<maxSizeRollBackups value="30"/>
<appendToFile value="true"/>
<staticLogFileName value="false"/>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:SS,fff} [%t] %-5p %c{1} - %m%n" />
</layout>
<filter type="log4net.Filter.StringMatchFilter">
<stringToMatch value="No -->"/>
<acceptOnMatch value ="true" />
</filter>
<filter type="log4net.Filter.StringMatchFilter">
<stringToMatch value="Statement Id: [vol.Delete"/>
<acceptOnMatch value ="false" />
</filter>
<filter type="log4net.Filter.StringMatchFilter">
<stringToMatch value="] Types: ["/>
<acceptOnMatch value ="false" />
</filter>
<filter type="log4net.Filter.StringMatchFilter">
<stringToMatch value="Statement Id: [vol."/>
<acceptOnMatch value ="true" />
</filter>
<filter type="log4net.Filter.DenyAllFilter"/>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="ConsoleAppender" />
<appender-ref ref="LogBufferingAppender" />
</root>
<logger name="PROGvolBatch.Services.CIService">
<level value="INFO" />
<appender-ref ref="SpecificAppender"/>
</logger>
<logger name="IBatisNet.DataMapper.Commands.DefaultPreparedCommand">
<level value="DEBUG" />
<appender-ref ref="SpecificAppender"/>
</logger>
<logger name="IBatisNet.DataMapper.Configuration.Cache.CacheModel">
<level value="OFF" />
<appender-ref ref="IBatisBufferingAppender" />
</logger>
<logger name="IBatisNet.DataMapper.LazyLoadList">
<level value="OFF" />
<appender-ref ref="IBatisBufferingAppender" />
</logger>
<logger name="IBatisNet.DataMapper.SqlMapSession">
<level value="OFF" />
<appender-ref ref="IBatisBufferingAppender" />
</logger>
<logger name="IBatisNet.Common.Transaction.TransactionScope">
<level value="OFF" />
<appender-ref ref="IBatisBufferingAppender" />
</logger>
<logger name="IBatisNet.DataAccess.DaoSession">
<level value="OFF" />
<appender-ref ref="IBatisBufferingAppender" />
</logger>
<logger name="IBatisNet.DataAccess.Configuration.DaoProxy">
<level value="OFF" />
<appender-ref ref="IBatisBufferingAppender" />
</logger>
<logger name="IBatisNet.DataMapper.Configuration.Statements.PreparedStatementFactory">
<level value="OFF" />
<appender-ref ref="IBatisBufferingAppender" />
</logger>
<logger name="IBatisNet.DataMapper.Commands.IPreparedCommand">
<level value="OFF" />
<appender-ref ref="IBatisBufferingAppender" />
</logger>
</log4net>
我尝试将根的级别更改为其他内容,但我总是得到相同的结果。