<configuration scan="true" scanPeriod="60 seconds" debug="false">
    <property name="PROJECT_PATH" value="/data/app/java/logs"/>
    <property name="APPLICATION_NAME" value="user"/>
    <property name="LOG_FILE_MAX_HISTORY" value="30"/>
    <property name="LOG_FILE_MAX_SIZE" value="50MB"/>


    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
    <include resource="org/springframework/boot/logging/logback/console-appender.xml"/>

    <!-- 异步输出 -->
    <appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
        <appender-ref ref="DefaultFile" />
    </appender>


    <appender name="DefaultFile"
              class="ch.qos.logback.core.rolling.RollingFileAppender">
        <append>true</append>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <pattern>${FILE_LOG_PATTERN}</pattern>
            <charset>UTF-8</charset>
        </encoder>
        <file>${PROJECT_PATH}/user/user.log</file>

        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>${logging.level}</level>
        </filter>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>${PROJECT_PATH}/${APPLICATION_NAME}/%d{yyyy-MM}/user-%d{yyyy-MM-dd}-%i.log.gz</fileNamePattern>
            <maxFileSize>${LOG_FILE_MAX_SIZE}</maxFileSize>
            <maxHistory>${LOG_FILE_MAX_HISTORY}</maxHistory>
        </rollingPolicy>
    </appender>

    <root level="info">
        <appender-ref ref="CONSOLE"/>
        <appender-ref ref="ASYNC"/>
    </root>

    <logger name="com.tmerclub.cloud" level="debug"/>
    <logger name="org.springframework.web.filter.CommonsRequestLoggingFilter" level="debug"/>
    <logger name="springfox.documentation.swagger.readers.operation.OperationImplicitParameterReader" level="off"/>
    <logger name="org.reflections.Reflections" level="off"/>
</configuration>