12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?xml version="1.0" encoding="utf-8"?>
- <log4net>
- <!-- Define some output appenders -->
- <appender name="rollingAppender" type="log4net.Appender.RollingFileAppender">
- <file value="loglog.txt" />
- <!--追加日志内容-->
- <appendToFile value="true" />
- <!--防止多线程时不能写Log,官方说线程非安全-->
- <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
- <!--可以为:Once|Size|Date|Composite-->
- <!--Composite为Size和Date的组合-->
- <rollingStyle value="Size" />
- <!--当备份文件时,为文件名加的后缀-->
- <datePattern value="yyyyMMdd.TXT" />
- <!--日志最大个数,都是最新的-->
- <!--rollingStyle节点为Size时,只能有value个日志-->
- <!--rollingStyle节点为Composite时,每天有value个日志-->
- <maxSizeRollBackups value="10" />
- <!--可用的单位:KB|MB|GB-->
- <maximumFileSize value="30MB" />
- <!--置为true,当前最新日志文件名永远为file节中的名字-->
- <staticLogFileName value="true" />
-
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger - %message%newline"/>
- </layout>
- </appender>
- <!-- levels: OFF > FATAL > ERROR > WARN > INFO > DEBUG > ALL -->
- <root>
- <priority value="ALL"/>
- <level value="ALL"/>
- <appender-ref ref="rollingAppender" />
- </root>
- </log4net>
|