<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright ${YEAR} bianxianmao.com All right reserved. This software is the confidential and proprietary information of
  ~ textile.com ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only
  ~ in accordance with the terms of the license agreement you entered into with bianxianmao.com.
  -->

<configuration>
    <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="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr([%d{yyyy-MM-dd HH:mm:ss.SSS}]){faint} %clr([${LOG_LEVEL_PATTERN:-%p}]) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr([%-40.40logger{39}]){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
    <property name="FILE_LOG_PATTERN" value="${FILE_LOG_PATTERN:-[%d{yyyy-MM-dd HH:mm:ss.SSS}] [${LOG_LEVEL_PATTERN:-%p}] ${PID:- } --- [%t] [%-40.40logger{39}] : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>

    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${CONSOLE_LOG_PATTERN}</pattern>
            <charset>utf8</charset>
        </encoder>
    </appender>

    <root level="INFO">
        <appender-ref ref="CONSOLE" />
    </root>
    <logger name="com.bxm.adx" level="INFO"/>

    <springProfile name="dev">
        <property name="LOG_FILE" value="../logs/adx-timer.log"/>
        <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <encoder>
                <pattern>${FILE_LOG_PATTERN}</pattern>
            </encoder>
            <file>${LOG_FILE}</file>
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}</fileNamePattern>
            </rollingPolicy>
        </appender>

        <root level="DEBUG">
            <appender-ref ref="CONSOLE" />
            <appender-ref ref="FILE" />
        </root>
        <logger name="com.bxm.adx" level="DEBUG"/>

    </springProfile>

    <springProfile name="test">
        <property name="LOG_FILE" value="../logs/adx-timer.log"/>
        <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <encoder>
                <pattern>${FILE_LOG_PATTERN}</pattern>
            </encoder>
            <file>${LOG_FILE}</file>
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}</fileNamePattern>
            </rollingPolicy>
        </appender>

        <root level="INFO">
            <appender-ref ref="CONSOLE" />
            <appender-ref ref="FILE" />
        </root>
        <logger name="com.bxm.adx" level="DEBUG"/>

    </springProfile>

    <springProfile name="pre">
        <property name="LOG_FILE" value="../logs/adx-timer.log"/>
        <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <encoder>
                <pattern>${FILE_LOG_PATTERN}</pattern>
            </encoder>
            <file>${LOG_FILE}</file>
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}</fileNamePattern>
            </rollingPolicy>
        </appender>

        <root level="INFO">
            <appender-ref ref="CONSOLE" />
            <appender-ref ref="FILE" />
        </root>
        <logger name="com.bxm.adx" level="INFO"/>
    </springProfile>

    <springProfile name="production,vpc">
        <property name="LOG_FILE" value="../logs/adx-timer.log"/>
        <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <encoder>
                <pattern>${FILE_LOG_PATTERN}</pattern>
            </encoder>
            <file>${LOG_FILE}</file>
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}</fileNamePattern>
            </rollingPolicy>
        </appender>

        <root level="WARN">
            <appender-ref ref="CONSOLE" />
            <appender-ref ref="FILE" />
        </root>
        <logger name="com.bxm" level="INFO"/>
    </springProfile>
</configuration>