<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<configuration>
    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%date{yyyy-MM-dd HH:mm:ss.SSS,CTT} [%thread] %-5level %logger{36} - %msg%n
            </pattern>
        </encoder>
    </appender>

    <appender name="rollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>/www/zzkjcloud/logs/td-service/td-service.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>/www/zzkjcloud/logs/td-service/td-service.%d{yyyy-MM-dd}-%i.log
            </fileNamePattern>
            <maxHistory>10</maxHistory>
            <!-- 除按日志记录之外，还配置了日志文件不能超过2M，若超过2M，日志文件会以索引0开始，
            命名日志文件，例如log-error-2013-12-21.0.log -->
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>256MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
        </rollingPolicy>
        <encoder>
            <pattern>%date{yyyy-MM-dd HH:mm:ss.SSS,CTT} [%thread] %-5level %logger{36} - %msg%n
            </pattern>
        </encoder>
    </appender>

    <appender name="errorFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>/www/zzkjcloud/logs/td-service/td-service-error.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>/www/zzkjcloud/logs/td-service/td-service-error.%d{yyyy-MM-dd}-%i.log
            </fileNamePattern>
            <maxHistory>10</maxHistory>
            <!-- 除按日志记录之外，还配置了日志文件不能超过2M，若超过2M，日志文件会以索引0开始，
            命名日志文件，例如log-error-2013-12-21.0.log -->
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>256MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
        </rollingPolicy>
        <encoder>
            <pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
            </pattern>
        </encoder>
        <!-- 此filter过滤debug级别以下的日志-->
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>ERROR</level>
        </filter>
        <!--  级别过滤器，根据日志级别进行过滤。-->
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <level>ERROR</level>
            <!--  表示不输出ERROR及以上日志-->
            <onMatch>ACCEPT</onMatch>
            <!--  表示输出ERROR以下日志-->
            <onMismatch>DENY</onMismatch>
        </filter>
    </appender>


    <!-- project default level -->
    <logger name="com.ho.td" level="DEBUG"/>

    <!--log4jdbc -->
    <logger name="jdbc.sqltiming" level="DEBUG"/>

    <root level="INFO">
        <appender-ref ref="console"/>
        <appender-ref ref="rollingFile"/>
        <appender-ref ref="errorFile"/>
    </root>
</configuration>