美文网首页
2018-08-07

2018-08-07

作者: LitOrange | 来源:发表于2018-08-07 09:07 被阅读0次

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>

相关文章

网友评论

      本文标题:2018-08-07

      本文链接:https://www.haomeiwen.com/subject/jqqovftx.html