log4net配置文件

Level级别:DEBUG <INFO<WARN<ERROR<FATAL

 

<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net configSource="log4net.config" />

 

<?xml version="1.0" encoding="utf-8"?>
<log4net>
<root>
<!--控制级别,由低到高: ALL|DEBUG|INFO|WARN|ERROR|FATAL|OFF-->
<!--比如定义级别为INFO,则INFO级别向下的级别,比如DEBUG日志将不会被记录-->
<!--如果没有定义LEVEL的值,则缺省为DEBUG-->
<!--<level value="ERROR"/>
<appender-ref ref="RollingFileAppender"/>-->
</root>
<logger name="DisLogFile">
<level value="All" />
<appender-ref ref="RollingFileAppender"/>-->
</logger>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="log\"/>
<appendToFile value="true"/>
<maxSizeRollBackups value="10"/>
<maximumFileSize value="1MB"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd&quot;.txt&quot;" />
<staticLogFileName value="false"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level %logger - %message%newline"/>
</layout>
</appender>
</log4net>

posted @ 2016-08-11 19:41  小羽信息  阅读(250)  评论(0编辑  收藏  举报