<?xml version="1.0" encoding="UTF-8" ?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
    <jmxConfigurator/>
    <property name="PROJECT_NAME" value="msxf-retail-sort" />
    <property name="LOG_FILE_INFO" value="${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/msxf-retail-sort-info.log" />
    <property name="LOG_FILE_WARN" value="${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/msxf-retail-sort-warn.log" />
    <property name="LOG_FILE_ERR" value="${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/msxf-retail-sort-error.log" />
    <property name="LOG_BUSINESS" value="${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/business/business-2de.log"/>
    <include resource="org/springframework/boot/logging/logback/defaults.xml" />
    <include resource="org/springframework/boot/logging/logback/console-appender.xml" />
    <contextName>${PROJECT_NAME}</contextName>

    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
        </encoder>
    </appender>


    <appender name="LOG_FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>INFO</level>
        </filter>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
        </encoder>
        <file>${LOG_FILE_INFO}</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${LOG_FILE_INFO}-7de.%d{yyyy-MM-dd}.%i</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy
                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>1024MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>

        </rollingPolicy>
    </appender>

    <appender name="LOG_FILE_WARN"
              class="ch.qos.logback.core.rolling.RollingFileAppender">
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>WARN</level>
        </filter>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
        </encoder>
        <file>${LOG_FILE_WARN}</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${LOG_FILE_WARN}-30de.%d{yyyy-MM-dd}.%i</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy
                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>1024MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
        </rollingPolicy>
    </appender>

    <appender name="LOG_FILE_ERROR"
              class="ch.qos.logback.core.rolling.RollingFileAppender">
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>ERROR</level>
        </filter>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
        </encoder>
        <file>${LOG_FILE_ERR}</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${LOG_FILE_ERR}.%d{yyyy-MM-dd}.%i</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy
                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>512MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
        </rollingPolicy>
    </appender>

    <!--添加监控日志 -->
    <appender name="business-log-appender"
              class="ch.qos.logback.core.rolling.RollingFileAppender">
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>info</level>
        </filter>
        <file>${LOG_BUSINESS}</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>${LOG_BUSINESS}.%d{yyyy-MM-dd}.%i
            </fileNamePattern>
            <maxFileSize>1024MB</maxFileSize>
        </rollingPolicy>
        <encoder>
            <pattern>%msg%n</pattern>
        </encoder>
    </appender>

    <logger name="business-log" additivity="false" level="info">
        <appender-ref ref="business-log-appender"/>
        <appender-ref ref="CONSOLE" />
    </logger>
    <!-- show parameters for hibernate sql 专为 Hibernate 定制 -->
    <logger name="logging.level.jdbc" level="INFO" />
    <logger name="logging.level.jdbc.sqlonly" level="INFO" />
    <logger name="org.springframework" level="INFO" additivity="true" />
    <Logger name="jdbc.sqlonly" level="info" />
    <Logger name="jdbc.sqltiming" level="warn" />
    <Logger name="jdbc.audit" level="warn" />
    <Logger name="jdbc.resultset" level="warn" />
    <Logger name="jdbc.resultsettable" level="warn" />
    <logger name="jdbc.connection" level="warn" />
    <Logger name="log4jdbc.debug" level="warn" />
    <Logger name="org.apache.kafka.clients.NetworkClient" level="ERROR" />

    <root level="INFO">
        <appender-ref ref="CONSOLE" />
<!--        <appender-ref ref="LOG_FILE_INFO" />-->
        <appender-ref ref="LOG_FILE_WARN" />
        <appender-ref ref="LOG_FILE_ERROR" />
    </root>
</configuration>