Using logback, debug messages are still being logg

2019-07-29 05:25发布

问题:

I have a project which has recently migrated from log4j to slf4j and logback. the root level is set to "Error", however, logs from third party libraries are still being logged at debug level.

Anyone has managed to solve this ?

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>