zoukankan      html  css  js  c++  java
  • logback.xml 日志配置

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration scan="true" scanPeriod="60 seconds" debug="false">
    
        <property name="LOG_HOME" value="./logs"/>
        <property name="ENCODER_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS}[%thread] %-5level %logger{80} - %msg%n"/>
    
        <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
            <layout class="ch.qos.logback.classic.PatternLayout">
                <pattern>${ENCODER_PATTERN}</pattern>
            </layout>
        </appender>
    
    
    
    
        <!-- 系统INFO日志 -->
        <appender name="INFO_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <file>${LOG_HOME}/info.log</file>
            <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
                <level>INFO</level><!-- 打印INFO及以上级别(INFO,WARN,ERROR) -->
            </filter>
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <fileNamePattern>${LOG_HOME}/history/info-%d{yyyyMMdd}.log</fileNamePattern>
                <maxHistory>7</maxHistory>
            </rollingPolicy>
            <encoder charset="UTF-8">
                <pattern>${ENCODER_PATTERN}</pattern>
            </encoder>
        </appender>
    
        <!-- 系统ERROR日志 -->
        <appender name="ERROR_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <file>${LOG_HOME}/error.log</file>
            <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
                <level>ERROR</level><!-- 打印ERROR及以上级别(ERROR) -->
            </filter>
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <fileNamePattern>${LOG_HOME}/history/error-%d{yyyyMMdd}.log</fileNamePattern>
                <maxHistory>7</maxHistory>
            </rollingPolicy>
            <encoder charset="UTF-8">
                <pattern>${ENCODER_PATTERN}</pattern>
            </encoder>
        </appender>
    
    
    
    
    
    
        <root level="INFO">
            <appender-ref ref="STDOUT"/>
            <appender-ref ref="INFO_LOG"/>
            <appender-ref ref="ERROR_LOG"/>
        </root>
    
    </configuration>
  • 相关阅读:
    监狱生活Felon
    [转]ios面试题收集(二)
    (转载)Xfermodes的扩展应用 图像擦除和还原效果
    (转)检测iPhone/iPod Touch/iPad设备类型
    iphone 推送服务Apple Push Notification Service
    [转]ios面试题收集(四)
    [转]ios面试题收集(五)
    [转]ios面试题收集(一)
    【很强大的ios代码大全】代码例子区全区搜索索引
    ios开发工程师常见面试题汇总
  • 原文地址:https://www.cnblogs.com/dongma/p/14747252.html
Copyright © 2011-2022 走看看