<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!--配置节点-->
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<!--自定义 logger-->
<appender name="CSVAppender" type="log4net.Appender.RollingFileAppender">
<!--日志路径-->
<param name="File" value="D:\\Data\\RunData\\" />
<!--是否是向文件中追加日志-->
<param name="AppendToFile" value="true" />
<!--log保留天数-->
<param name="MaxSizeRollBackups" value="30" />
<!--log文件大小-->
<param name="maximumFileSize" value="100MB"/>
<!--日志文件名是否是固定不变的-->
<param name="StaticLogFileName" value="false" />
<!--日志文件名格式为:2008-08-31.log-->
<param name="DatePattern" value="yyyy-MM-dd'''.csv'" />
<!--日志根据日期滚动-->
<param name="RollingStyle" value="Composite" />
<!--最小锁定模型以允许多个进程可以写入同一个文件-->
<param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy'/'MM'/'dd HH':'mm':'ss},%m%n" />
</layout>
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="INFO" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
</appender>
<!--默认 Root logger-->
<appender name="InfoAppender" type="log4net.Appender.RollingFileAppender">
<!--日志路径-->
<param name="File" value="Log\\Info\\" />
<!--是否是向文件中追加日志-->
<param name="AppendToFile" value="true" />
<!--log保留天数-->
<param name="MaxSizeRollBackups" value="30" />
<!--log文件大小-->
<param name="maximumFileSize" value="100MB"/>
<!--日志文件名是否是固定不变的-->
<param name="StaticLogFileName" value="false" />
<!--日志文件名格式为:2008-08-31.log-->
<param name="DatePattern" value="yyyy-MM-dd'_INFO''.log'" />
<!--日志根据日期滚动-->
<param name="RollingStyle" value="Composite" />
<!--最小锁定模型以允许多个进程可以写入同一个文件-->
<param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [thread:%t] %-3p %F line:%L func:%c - %m%n" />
</layout>
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="INFO" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
</appender>
<appender name="DebugAppender" type="log4net.Appender.RollingFileAppender">
<!--日志路径-->
<param name="File" value="Log\\Debug\\" />
<!--是否是向文件中追加日志-->
<param name="AppendToFile" value="true" />
<!--log保留天数-->
<param name="MaxSizeRollBackups" value="30" />
<!--log文件大小-->
<param name="maximumFileSize" value="100MB"/>
<!--日志文件名是否是固定不变的-->
<param name="StaticLogFileName" value="false" />
<!--日志文件名格式为:2008-08-31.log-->
<param name="DatePattern" value="yyyy-MM-dd'_DEBUG''.log'" />
<!--日志根据日期滚动-->
<param name="RollingStyle" value="Composite" />
<!--最小锁定模型以允许多个进程可以写入同一个文件-->
<param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [thread:%t] %-5p %7c - %m%n" />
</layout>
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="DEBUG" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
</appender>
<appender name="ErrorAppender" type="log4net.Appender.RollingFileAppender">
<!--日志路径-->
<param name="File" value="Log\\Error\\" />
<!--是否是向文件中追加日志-->
<param name="AppendToFile" value="true" />
<!--log保留天数-->
<param name="MaxSizeRollBackups" value="30" />
<!--log文件大小-->
<param name="maximumFileSize" value="100MB"/>
<!--日志文件名是否是固定不变的-->
<param name="StaticLogFileName" value="false" />
<!--日志文件名格式为:2008-08-31.log-->
<param name="DatePattern" value="yyyy-MM-dd'_ERROR''.log'" />
<!--日志根据日期滚动-->
<param name="RollingStyle" value="Composite" />
<!--最小锁定模型以允许多个进程可以写入同一个文件-->
<param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [thread:%t] %p %c - %m%n" />
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="ERROR" />
<levelMax value="ERROR"/>
</filter>
<!--<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="ERROR" />
</filter>-->
</appender>
<root>
<!--(高) OFF > FATAL > ERROR > WARN > INFO > DEBUG > ALL (低) -->
<!--系统上线初期或发生异常可将此Level设定为DEBUG或ALL-->
<level value="ALL" />
<appender-ref ref="InfoAppender" />
<appender-ref ref="DebugAppender" />
<appender-ref ref="ErrorAppender" />
</root>
<!--自定义 Logger-->
<logger name="Custom_CSV" additivity="false">
<level value="ALL"/>
<appender-ref ref="CSVAppender" />
</logger>
</log4net>
</configuration>