<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">

    <Properties>
        <Property name="log.path">../mesnac/logs</Property>
        <Property name="log.pattern">%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n</Property>
    </Properties>

    <!-- 日志输出器 -->
    <Appenders>
        <Console name="console" target="SYSTEM_OUT">
            <PatternLayout>
                <pattern>${log.pattern}</pattern>
            </PatternLayout>
        </Console>

        <RollingFile name="file_info"
                     fileName="${log.path}/mes-info.log"
                     filePattern="${log.path}/$${date:yyyy-MM}/mes-info.%d{yyyy-MM-dd}-%i.log">
            <Filters>
                <ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL" />
                <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
            </Filters>
            <PatternLayout>
                <pattern>${log.pattern}</pattern>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="10MB"/>
            </Policies>
        </RollingFile>

        <RollingFile name="file_error"
                     fileName="${log.path}/mes-error.log"
                     filePattern="${log.path}/$${date:yyyy-MM}/mes-error.%d{yyyy-MM-dd}-%i.log">
            <ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
            <PatternLayout>
                <pattern>${log.pattern}</pattern>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="10MB"/>
            </Policies>
        </RollingFile>
    </Appenders>


    <Loggers>
        <logger name="info" level="debug">
            <AppenderRef ref="file_info"/>
        </logger>
        <Root level="error">
            <AppenderRef ref="console"/>
            <AppenderRef ref="file_error"/>
        </Root>
    </Loggers>

</Configuration>