<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="10 seconds">

    <!-- 属性定义保持不变 -->
    <property name="APP_NAME" value="DocCheckTool"/>
    <property name="LOG_HOME" value="${log.dir:-logs}"/>
    <property name="RELEASE_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss} [%level] %msg%n"/>
    <property name="DEBUG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n"/>
    <property name="TRACKER_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n"/>

    <contextName>${APP_NAME}</contextName>

    <!-- 控制台输出 -->
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder charset="UTF-8" >
            <pattern>${DEBUG_PATTERN}</pattern>
        </encoder>
    </appender>

    <!-- RELEASE 文件日志 - 只接收 RELEASE marker -->
    <appender name="RELEASE_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${LOG_HOME}/release.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${LOG_HOME}/release.%d{yyyy-MM-dd}.log</fileNamePattern>
            <maxHistory>7</maxHistory>
        </rollingPolicy>
        <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
            <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
                <marker>RELEASE</marker>
            </evaluator>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
        <encoder charset="UTF-8">
            <pattern>${RELEASE_PATTERN}</pattern>
        </encoder>
    </appender>

    <!-- DEBUG 文件日志 - 只接收 DEBUG marker -->
    <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${LOG_HOME}/debug/debug.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${LOG_HOME}/debug/debug.%d{yyyy-MM-dd}.log</fileNamePattern>
            <maxHistory>7</maxHistory>
        </rollingPolicy>
        <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
            <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
                <marker>DEBUG</marker>
            </evaluator>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
        <encoder charset="UTF-8">
            <pattern>${DEBUG_PATTERN}</pattern>
        </encoder>
    </appender>

    <!-- TRACKER 文件日志 - 只接收 TRACE marker -->
    <appender name="TRACKER_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${LOG_HOME}/debug/tracker.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${LOG_HOME}/debug/tracker.%d{yyyy-MM-dd}.log</fileNamePattern>
            <maxHistory>7</maxHistory>
        </rollingPolicy>
        <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
            <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
                <marker>TRACE</marker>
            </evaluator>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
        <encoder charset="UTF-8">
            <pattern>${TRACKER_PATTERN}</pattern>
        </encoder>
    </appender>

    <!-- Logger 定义 -->
    <logger name="log.release" level="INFO" additivity="false">
        <appender-ref ref="RELEASE_FILE"/>
        <appender-ref ref="STDOUT"/>
    </logger>

    <logger name="log.debug" level="DEBUG" additivity="false">
        <appender-ref ref="DEBUG_FILE"/>
        <appender-ref ref="STDOUT"/>
    </logger>

    <logger name="log.tracker" level="TRACE" additivity="false">
        <appender-ref ref="TRACKER_FILE"/>
        <appender-ref ref="STDOUT"/>
    </logger>
    <!-- 添加你刚刚添加的logger -->
    <logger name="top.r3944realms.docchecktoolrefactored" level="DEBUG" additivity="false">
        <appender-ref ref="RELEASE_FILE"/>
        <appender-ref ref="DEBUG_FILE"/>
        <appender-ref ref="TRACKER_FILE"/>
        <appender-ref ref="STDOUT"/>
    </logger>

    <!-- ROOT Logger - 输出到控制台 -->
    <root level="INFO">
        <appender-ref ref="STDOUT"/>
    </root>

</configuration>