<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" monitorInterval="30">

    <Properties>
        <Property name="LOG_LEVEL" value="${sys:log.commonLevel}"/>
        <Property name="LOG_DIR" value="../logs/examcloud-core-questions"/>
        <Property name="LOG_PATTERN">
            %d{yyyy-MM-dd HH:mm:ss.SSS} | %clr{%level} | %X{TRACE_ID} %X{CALLER} | %clr{%c{1.1}:%L}{cyan} | %m%n
        </Property>
    </Properties>

    <Appenders>
        <Console name="CONSOLE_APPENDER" target="SYSTEM_OUT">
            <PatternLayout pattern="${LOG_PATTERN}" charset="UTF-8"/>
        </Console>

        <RollingFile name="FILE_APPENDER"
                     fileName="${LOG_DIR}/debug.log"
                     filePattern="${LOG_DIR}/debug-%d{yyyyMMdd}-%i.log">
            <PatternLayout pattern="${LOG_PATTERN}" charset="UTF-8"/>

            <Policies>
                <TimeBasedTriggeringPolicy interval="1" modulate="false"/>
                <SizeBasedTriggeringPolicy size="100 MB"/>
            </Policies>

            <DefaultRolloverStrategy max="1000">
                <Delete basePath="${LOG_DIR}" maxDepth="1">
                    <IfFileName glob="debug-*.log">
                        <IfAccumulatedFileSize exceeds="10 GB"/>
                    </IfFileName>
                </Delete>
            </DefaultRolloverStrategy>
        </RollingFile>
    </Appenders>

    <Loggers>
        <logger name="springfox.documentation" level="WARN"/>
        <logger name="org.springframework" level="WARN"/>
        <logger name="org.hibernate" level="WARN"/>
        <logger name="org.apache" level="WARN"/>
        <logger name="org.quartz" level="WARN"/>
        <logger name="org.docx4j" level="WARN"/>
        <logger name="cn.afterturn" level="WARN"/>
        <logger name="com.netflix" level="WARN"/>
        <logger name="com.aliyun" level="WARN"/>
        <logger name="io.lettuce" level="WARN"/>
        <logger name="io.netty" level="WARN"/>

        <!--<Logger name="org.hibernate.SQL" level="DEBUG"/>-->
        <!--<Logger name="org.hibernate.engine.transaction" level="DEBUG"/>-->
        <!--<Logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE"/>-->
        <!--<logger name="org.springframework.jdbc.core.JdbcTemplate" level="DEBUG"/>-->
        <!--<logger name="org.springframework.data.mongodb" level="DEBUG"/>-->
        <!--<logger name="org.springframework.data.redis" level="DEBUG"/>-->

        <Logger name="cn.com.qmth" level="${LOG_LEVEL}" additivity="false">
            <AppenderRef ref="CONSOLE_APPENDER"/>
            <AppenderRef ref="FILE_APPENDER"/>
        </Logger>

        <Root level="${LOG_LEVEL}">
            <AppenderRef ref="CONSOLE_APPENDER"/>
            <AppenderRef ref="FILE_APPENDER"/>
        </Root>
    </Loggers>

</Configuration>
