1 <?xml version="1.0" encoding="UTF-8"?> 2 <log4net> 3 <root> 4 <level value="all" /> 5 <appender-ref ref="LogFileAppenderByDate" /> 6 </root> 7 <appender name="LogFileAppenderByDate" type="log4net.Appender.RollingFileAppender" > 8 <param name="AppendToFile" value="true" /> 9 <!--最小锁定模型以允许多个进程可以写入同一个文件--> 10 <param name="LockingModel" value="log4net.Appender.FileAppender+MinimalLock" /> 11 <param name="StaticLogFileName" value="true" /> 12 <param name="File" value="Log\\" /> 13 <param name="DatePattern" value="yyyyMM\\yyyy-MM-dd‘.txt‘" /> 14 <param name="StaticLogFileName" value="false" /> 15 <param name="RollingStyle" value="Composite" /> 16 <maxSizeRollBackups value="-1" /> 17 <maximumFileSize value="2MB" /> 18 <layout type="log4net.Layout.PatternLayout"> 19 <param name="ConversionPattern" value="%n-----%d-----%n%level%n%c%nline %L%n%m%n" /> 20 </layout> 21 </appender> 22 </log4net>
注意:<!--最小锁定模型以允许多个进程可以写入同一个文件-->
1 <param name="LockingModel" value="log4net.Appender.FileAppender+MinimalLock" />
时间: 2024-12-13 08:01:19