<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="true" scanPeriod="1 seconds">
    <contextName>docus-server-fistpage</contextName>
    <property name="log.path" value="logs/logback"/>

    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>[%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%contextName] [%thread] [%X{traceId}] %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>

    <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <encoder>
            <!-- 指定日志输出格式 -->
            <pattern>[%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%C] [%t] [%X{traceId}] [%L] [%-5p] %m%n</pattern>
            <charset>utf-8</charset>
        </encoder>
        <!-- 指定收集策略：滚动策略-->
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!--指定生成日志保存地址 -->
            <fileNamePattern>${log.path}%d.%i.log</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy
                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>500MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <MaxHistory>30</MaxHistory>
        </rollingPolicy>
    </appender>
    <appender name="external-interface" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <encoder>
            <!-- 指定日志输出格式 -->
            <pattern>[%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%C] [%t] [%X{traceId}] [%L] [%-5p] %m%n</pattern>
            <charset>utf-8</charset>
        </encoder>
        <!-- 指定收集策略：滚动策略-->
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!--指定生成日志保存地址 -->
            <fileNamePattern>${log.path}external%d.%i.log</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy
                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>500MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <MaxHistory>30</MaxHistory>
        </rollingPolicy>
    </appender>
    <logger name="com.docus.services.system.service.ClientGetBasicServiceImpl" level="DEBUG" additivity="false">
        <appender-ref ref="external-interface" />
    </logger>


    <springProfile name="dev">
        <root level="debug">
            <appender-ref ref="console"/>
        </root>

    </springProfile>


    <springProfile name="test|prod">
        <root level="INFO">
            <appender-ref ref="file"/>
        </root>
    </springProfile>

	    <!--    监控sql日志输出-->
    <!--  如想看到表格数据，将OFF改为INFO  -->
    <logger name="jdbc.resultsettable" level="OFF" additivity="false">
        <appender-ref ref="console"/>
    </logger>

    <!--    包含 SQL 语句实际的执行时间 及sql语句（与jdbc.sqlonly功能重复）   -->
    <logger name="jdbc.sqltiming" level="OFF" additivity="false">
        <appender-ref ref="file"/>
    </logger>

    <!--      仅仅记录 SQL 语句，会将占位符替换为实际的参数-->
    <logger name="jdbc.sqlonly" level="OFF" additivity="false">
        <appender-ref ref="console"/>
    </logger>

    <!--  包含 ResultSet 的信息，输出篇幅较长  -->
    <logger name="jdbc.resultset" level="OFF" additivity="false">
        <appender-ref ref="console"/>
    </logger>

    <!-- 输出了 Connection 的 open、close 等信息  -->
    <logger name="jdbc.connection" level="OFF" additivity="false">
        <appender-ref ref="console"/>
    </logger>

    <!--    除了 ResultSet 之外的所有JDBC调用信息，篇幅较长 -->
    <logger name="jdbc.audit" level="OFF" additivity="false">
        <appender-ref ref="console"/>
    </logger>
</configuration>
