12345678910111213141516171819202122232425262728293031323334 |
- <?xml version="1.0" encoding="utf-8" ?>
- <configuration>
- <configSections>
- <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
- </configSections>
- <log4net>
- <!-- 定义输出到文件中 -->
- <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
- <!--定义文件存放位置-->
- <file value="logs\\"/>
- <appendToFile value="true"/>
- <rollingStyle value="Date"/>
- <datePattern value="yyyy-MM-dd'.txt'"/>
- <staticLogFileName value="false"/>
- <!--日志最大可备份数-->
- <maxSizeRollBackups value="100"/>
- <!--日志文件大小-->
- <maximumFileSize value="1024KB"/>
- <layout type="log4net.Layout.PatternLayout">
- <!--每条日志末尾的文字说明-->
- <!--输出格式-->
- <!--样例:2008-03-26 13:42:32,111 [10] INFO Log4NetDemo.MainClass [(null)] - info-->
- <conversionPattern value="%newline %n记录时间:%date %n线程ID:[%thread] %n日志级别: %-5level %n出错类:%logger property: [%property{NDC}] - %n错误描述:%message%newline %n"/>
- </layout>
- </appender>
- <root>
- <level value="DEBUG"/>
- <!--文件形式记录日志-->
- <appender-ref ref="RollingLogFileAppender"/>
- </root>
- </log4net>
- </configuration>
|