<?xml version="1.0" encoding="UTF-8"?>

<configuration>
    <appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender">
        <layout class="ch.qos.logback.classic.PatternLayout">
            <pattern>
                %d{HH:mm:ss.SSS} [%thread] %-5level %c %M %L - %msg%n
            </pattern>
        </layout>
    </appender>

    <!-- 运行日志 -->
    <appender name="runtimeLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <layout class="ch.qos.logback.classic.PatternLayout">
            <pattern>
                %d{HH:mm:ss.SSS} [%thread] %-5level %c %M %L - %msg%n
            </pattern>
        </layout>
        <!-- 滚动策略 -->
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>
                logs/oss-store.%d.log
            </fileNamePattern>
        </rollingPolicy>
    </appender>

    <!-- 根据 spring 的不同环境使用不同的日志配置 -->
    <springProfile name="dev">
        <root level="info">
            <appender-ref ref="consoleLog"></appender-ref>
        </root>
    </springProfile>
    <springProfile name="test">
        <root level="info">
            <appender-ref ref="runtimeLog"></appender-ref>
        </root>
    </springProfile>
    <springProfile name="prod">
        <root level="info">
            <appender-ref ref="runtimeLog"></appender-ref>
        </root>
    </springProfile>
</configuration>