我的日志级别设置为“INFO”,但是日志中出现了“DEBUG”事件。
配置
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<level value="INFO"/>
<file value="Logs\Log.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<root>
<appender-ref ref="RollingFileAppender"/>
</root>
</log4net>
</configuration>
代码
private ILog Log { get; set; }
static Program()
{
XmlConfigurator.Configure();
//...
this.Log.Info("Started in RunOnce mode.");
}