Logback不会将日志写入文件而是控制台

时间:2013-07-05 03:40:30

标签: logback

我不知道为什么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>

1 个答案:

答案 0 :(得分:0)

您已将您的appender命名为ref =“FILE”,并将您的根级别记录器命名为“ASYNC”