使用logback,仍会记录调试消息,但根级别设置为"错误"

时间:2017-02-15 13:23:19

标签: java logback slf4j

我有一个最近从log4j迁移到slf4j和logback的项目。根级别设置为"错误"但是,仍然在调试级别记录来自第三方库的日志。

任何人都设法解决了这个问题?

Logback.xml:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

       <appender name="FILE" class="ch.qos.logback.core.FileAppender" additivity="false">
            <file>${catalina.home}/logs/database.log</file>

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

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender" additivity="false">
    <!-- encoders are assigned the type
         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
    <encoder>
        <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n</pattern>
    </encoder>
  </appender>


  <root level="ERROR">         
    <appender-ref ref="STDOUT" />

    <appender-ref ref="FILE" />
  </root> 

</configuration>

0 个答案:

没有答案