我试图在Visual Studio 2005的ASP.NET应用程序中使用log4net。我已经声明了日志记录器的实例,如:
Private Shared ReadOnly log As ILog = LogManager.GetLogger("")
我试图用以下方式使用它:
If log.IsDebugEnabled Then log.Debug("Integration Services Constructed") End If
这是我的配置:
<log4net> <root> <level value="DEBUG" /> <appender-ref ref="RollingFileAppender" /> </root> <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="..\\logs\\logfile.log"/> <appendToFile value="true"/> <rollingStyle value="Size"/> <maxSizeRollBackups value="10"/> <maximumFileSize value="1MB"/> <staticLogFileName value="true"/> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"/> </layout> <filter type="log4net.Filter.LevelRangeFilter"> <param name="LevelMin" value="DEBUG" /> <param name="LevelMax" value="FATAL" /> </filter> </appender> </log4net>
不幸的是,log.IsDebugEnabled始终为false。如何配置log4net,以便我只能记录调试消息?