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

    <springProperty scope="context" name="logLevel" source="logging.level.root" />

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}| %thread | %level | %X{TRACE_ID} - %X{KEY} | %m | [%class:%line]%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <!-- debug 日志 -->
    <appender name="DEBUG_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>logs/themis-task.log</file>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}| %thread | %level | %X{TRACE_ID} - %X{KEY} | %m | [%class:%line]%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>logs/themis-task.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
            <maxHistory>100</maxHistory>
            <maxFileSize>100MB</maxFileSize>
        </rollingPolicy>
    </appender>

    <logger name="org.springframework" level="${logLevel}" additivity="false">
        <appender-ref ref="DEBUG_APPENDER"/>
        <appender-ref ref="STDOUT" />
    </logger>

    <logger name="com.qmth.themis.task" level="${logLevel}" additivity="false">
        <appender-ref ref="DEBUG_APPENDER" />
        <appender-ref ref="STDOUT" />
    </logger>

    <root level="INFO">
        <appender-ref ref="DEBUG_APPENDER" />
        <appender-ref ref="STDOUT" />
    </root>

</configuration>