C#的log4net、log2console、rollingfile综合配置

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
  </configSections>
  <log4net>
    <root>
      <appender-ref ref="UdpAppender"/>
      <!--<appender-ref ref="RollingFileAppender"/>-->
    </root>
    <appender name="UdpAppender" type="log4net.Appender.UdpAppender">
      <remoteAddress value="127.0.0.1" />
      <remotePort value="7071" />
      <layout type="log4net.Layout.XmlLayoutSchemaLog4j" />
    </appender>
    <!--<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
      <file value="log.txt" />
      <appendToFile value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="10" />
      <maximumFileSize value="100KB" />
      <staticLogFileName value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level - %message%newline" />
      </layout>
    </appender>-->
  </log4net>
</configuration>

其它内容和以前的博客一样。

http://www.cnblogs.com/yao2yao4/archive/2013/06/06/3120355.html

posted on 2013-06-07 20:17  yao2yao4  阅读(486)  评论(0编辑  收藏  举报

导航