<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
    <property name="app_name" value="admin"/>
    <property name="LOG_HOME" value="/logs/ll-administrative-service"/>
    <timestamp key="byMilSecond" datePattern="yyyy-MM-dd'T'HH:mm:ss.SSS"/>
    <contextName>${app_name}</contextName>
    <!--<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
        <resetJUL>true</resetJUL>
    </contextListener>-->
    <!-- <jmxConfigurator/>-->
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        </encoder>
    </appender>

    <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${LOG_HOME}/${app_name}/info/info.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${LOG_HOME}/${app_name}/info/info.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
            <maxHistory>5</maxHistory>
            <!-- 日志总保存量为10GB -->
            <totalSizeCap>10GB</totalSizeCap>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <!--文件达到 最大128MB时会被压缩和切割 -->
                <maxFileSize>200MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
        </rollingPolicy>

        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        </encoder>
        <!--<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <MaxFileSize>1000MB</MaxFileSize>
        </triggeringPolicy>-->
    </appender>
    <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>ERROR</level>
        </filter>
        <file>${LOG_HOME}/${app_name}/error/error.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${LOG_HOME}/${app_name}/error/error.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
            <maxHistory>30</maxHistory>
            <totalSizeCap>10GB</totalSizeCap>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>200MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
        </rollingPolicy>

        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSS} [%thread] %-5level %logger{35} - %msg%n</pattern>
        </encoder>
        <!--<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <MaxFileSize>1000MB</MaxFileSize>
        </triggeringPolicy>-->
    </appender>

    <root level="INFO">
        <appender-ref ref="STDOUT"/>
        <appender-ref ref="INFO_FILE"/>
        <appender-ref ref="ERROR_FILE"/>
    </root>
    <!-- 将org.springframework.web包下的类的日志级别设置为DEBUG，
            我们开发Spring MVC经常出现和参数类型相关的4XX错误，设置此项我们可以看到更相信的信息 -->
    <logger name="org.springframework.web" level="DEBUG"/>
    <!-- show parameters for hibernate sql 专为 Hibernate 定制 -->
    <!--<log name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE"/>
    <log name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG"/>
    <log name="org.hibernate.SQL" level="DEBUG"/>
    <log name="org.hibernate.engine.QueryParameters" level="DEBUG"/>
    <log name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG"/>-->

    <!--myibatis log configure -->
    <logger name="com.apache.ibatis" level="TRACE"/>
    <logger name="java.sql.Connection" level="DEBUG"/>
    <logger name="java.sql.Statement" level="DEBUG"/>
    <logger name="java.sql.PreparedStatement" level="DEBUG"/>
    <logger name="java.sql.ResultSet" level="DEBUG"/>
    <logger name="java.sql" level="DEBUG"/>
    <logger name="druid.sql" level="INFO"/>
    <logger name="com.ibatis" level="DEBUG"/>
    <logger name="com.ibatis.common.jdbc.SimpleDataSource" level="INFO"/>
    <logger name="com.ibatis.common.jdbc.ScriptRunner" level="INFO"/>
    <logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate" level="INFO"/>
    <logger name="org.mybatis" level="INFO"/>
    <logger name="org.springframework.jdbc" level="INFO"/>
    <logger name="com.alibaba.druid" level="INFO"/>
</configuration>