Log4Net 配置
Log4Net的分文件配置范例
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net debug="true">
<root>
<level value="DEBUG" />
<appender-ref ref="RollingLogFileAppender" />
<appender-ref ref="ConsoleAppender" />
</root>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date] %level [%thread][%c{1}:%line] - %m%n" />
</layout>
</appender>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender" >
<param name="File" value="debuglog.log" />
<param name="DatePattern" value="'.'yyyy-MM-dd-HH'.log'" />
<param name="AppendToFile" value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date] %level [%thread][%c{1}:%line] - %m%n" />
</layout>
</appender>
</log4net>
</configuration>
网友评论