zoukankan      html  css  js  c++  java
  • Rolling File Appender使用示例

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <!--In a config file where there will (potentially) be more information stored
    beyond just the log4net configuration information,
    you will need to specify a section to identify where the log4net configuration is housed.-->
    <configSections>
    <section name="log4net"
    type="log4net.Config.Log4NetConfigurationSectionHandler,log4net-net-1.0"/>
    </configSections>

    <log4net>
    <root>
    <level value="INFO" />
    <appender-ref ref="RollingFileAppender" />
    </root>

    <!--Note that the logger name is the full name of the class including the namespace.
    If you wanted to monitor an entire namespace,
    it would be as simple as listing just the namespace you wanted to monitor.
    I would recommend against trying to re-use appenders in multiple loggers.
    It can be done, but you can get some unpredictable results.-->
    <logger name="ModemApplication.Logging">
    <level value="DEBUG"/>
    </logger>

    <!--the log file should be capped at 10MB and keep up to 5 archive files
    before start deleting them (oldest gets deleted first).
    The archives will be named with the same name as the file,
    only with a dot and the number after it.-->
    <appender name="RollingFileAppender"
    type="log4net.Appender.RollingFileAppender" >
    <param name="File" value="GetMessage-logfile.txt" />
    <param name="AppendToFile" value="true" />
    <param name="rollingStyle" valye="Size" />
    <param name="maxSizeRollBackups" value="5" />
    <param name="maximumFileSize" value="1MB" />
    <param name="staticLogFileName" value="true" />
    <layout type="log4net.Layout.PatternLayout">
    <param name="ConversionPattern"
    value="%date [%thread] %-5level %c - %message %exception%n"
    />
    </layout>
    <!--When a message fits inside the criteria for a filter,
    it is logged and the processing of the filter is finished.-->
    <filter type="log4net.Filter.LevelRangeFilter">
    <param name="LevelMin" value="INFO" />
    <param name="LevelMax" value="FATAL" />
    </filter>
    <!--its true purpose is to specify that nothing more should be logged -->
    <filter type="log4net.Filter.DenyAllFilter" />
    </appender>

    </log4net>
    </configuration>


     

  • 相关阅读:
    java架构解密——实时动态aop
    guice基本使用,配置模块的两种方式(三)
    guice基本使用,三种注入方式(二)
    guice的基本使用(一)
    Java 集合系列10之 HashMap详细介绍(源码解析)和使用示例
    java泛型(二)、泛型的内部原理:类型擦除以及类型擦除带来的问题
    java泛型(一)、泛型的基本介绍和使用
    java泛型学习(2)
    jquery,从后台查数据,给页面上添加树形。
    Java Annotation认知(包括框架图、详细介绍、示例说明)
  • 原文地址:https://www.cnblogs.com/ttssrs/p/2431273.html
Copyright © 2011-2022 走看看