此为多线程写日志造成
解决办法,在appender节点里添加:
<param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
完整XML示例:
<log4net> <root> <level value="ALL" /> <appender-ref ref="RollingLogFileAppender" /> </root> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> <param name="File" value="Log/" /> <param name="AppendToFile" value="true" /> <param name="MaxSizeRollBackups" value="10" /> <param name="StaticLogFileName" value="false" /> <param name="DatePattern" value="yyyy-MM-dd".log"" /> <param name="RollingStyle" value="Date" /> <layout type="log4net.Layout.PatternLayout"> <param name="Header" value="----------------------------------------[Header]--------------------------------------

" /> <param name="Footer" value="----------------------------------------[Footer]--------------------------------------

" /> <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n%n" /> </layout> </appender> </log4net>
标签:log4net,解决办法,重叠,示例,文件名,多线程 From: https://www.cnblogs.com/nanfei/p/17035877.html