用log4net怎么配置可以实现当天的log写到当天的文件里?
用:RollingLogFileAppender,如何配置log4nett可使当天的log写到当天的文件里?
谢谢各位大哥
------解决方案--------------------设置好下面两个属性
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd" />
我这边一个例子
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value=".\xx.log" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%thread] %message --- (%-5level %logger [%ndc])%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingLogFileAppender" />
</root>
</log4net>
</configuration>