1

我不知道为什么logback将日志写入控制台,请帮助谢谢。

<configuration debug="true" scan="true">



    <appender name="FILE"
        class="ch.qos.logback.core.rolling.RollingFileAppender">

        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>/log/%d{yyyy-MM-dd}.%i.log</fileNamePattern>
            <maxHistory>30</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
                %msg%n</pattern>
        </encoder>
    </appender>

    <appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
        <appender-ref ref="FILE" />
        <includeCallerData>true</includeCallerData>
    </appender>

    <root level="INFO">
        <appender-ref ref="ASYNC" />
    </root>

    <root level="ERROR">
        <appender-ref ref="ASYNC" />
    </root>
</configuration>
4

1 回答 1

0

您已将附加程序命名为相同的 ref="FILE",并将根级别记录器命名为“ASYNC”

于 2013-07-05T03:46:35.347 回答