<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
    <conversionRule conversionWord="clr" class="com.njzscloud.common.core.log.ColorConverter"/>

    <property name="log_path" value="logs"/>
    <property name="service_name" value="${appname}"/>

    <property name="console_pattern" value="%magenta(%d{yyyy-MM-dd HH:mm:ss.SSS}) %clr(%-5p) %blue([%t]) %cyan(%c) %blue([%M:%L]): %clr(%m%n)"/>

    <property name="file_pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p [%t] %c [%M:%L] : %m%n"/>

    <appender name="console_appender" class="ch.qos.logback.core.ConsoleAppender">
        <withJansi>false</withJansi>
        <encoder>
            <pattern>${console_pattern}</pattern>
        </encoder>
    </appender>

    <appender name="file_appender" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log_path}/${service_name}.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>${log_path}/%d{yyyy-MM, aux}/${service_name}.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
            <maxFileSize>50MB</maxFileSize>
            <maxHistory>15</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>${file_pattern}</pattern>
        </encoder>
    </appender>

    <!-- TRACE < DEBUG < INFO <  WARN < ERROR -->
    <root level="WARN">
        <appender-ref ref="console_appender"/>
        <appender-ref ref="file_appender"/>
    </root>
</configuration>
