<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="true" scanPeriod="60 seconds">

    <!--<contextName>fees-api</contextName>-->
    <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
    <conversionRule conversionWord="wex"
                    converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
    <conversionRule conversionWord="wEx"
                    converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
    <property name="log.filePath" value="./log"/>
    <!-- 0：不限制 -->
    <property name="log.maxHistory" value="60"/>

    <property name="appName" value="thrid-system-gateway"/>
    <property name="logPattern"
              value="${CONSOLE_LOG_PATTERN:-%clr([%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}}]){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${logPattern}</pattern>
        </encoder>
    </appender>

    <appender name="ROLLING_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}${file.separator}${appName}.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <FileNamePattern>
                ${log.filePath}${file.separator}%d{yyyy,aux}${file.separator}%d{yyyy-MM,aux}${file.separator}${appName}_%d{yyyyMMdd}_%i.log
            </FileNamePattern>
            <!--日志文件最大的保存历史数量,只有当每天生成且只生成一个文件时才表示保留天数-->
            <maxHistory>${log.maxHistory}</maxHistory>
            <maxFileSize>10MB</maxFileSize>
            <totalSizeCap>500MB</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>${logPattern}</pattern>
        </encoder>
    </appender>

    <logger name="com.tofly.third" level="WARN"/>
    <logger name="org.springframework.web.client" level="WARN"/>

    <root level="warn">
        <appender-ref ref="STDOUT"/>
        <appender-ref ref="ROLLING_LOG"/>
    </root>
</configuration>