LYCZ007

logback ThresholdFilter

http://logback.qos.ch/manual/filters.html

 

The ThresholdFilter filters events below the specified threshold. For events of level equal or above the threshold, ThresholdFilter will respond NEUTRAL when its decide() method is invoked. However, events with a level below the threshold will be denied. Here is a sample configuration file.

 1 <configuration>
 2   <appender name="CONSOLE"
 3     class="ch.qos.logback.core.ConsoleAppender">
 4     <!-- deny all events with a level below INFO, that is TRACE and DEBUG -->
 5     <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
 6       <level>INFO</level>
 7     </filter>
 8     <encoder>
 9       <pattern>
10         %-4relative [%thread] %-5level %logger{30} - %msg%n
11       </pattern>
12     </encoder>
13   </appender>
14   <root level="DEBUG">
15     <appender-ref ref="CONSOLE" />
16   </root>
17 </configuration>

 

posted on 2020-06-04 06:32  LYCZ007  阅读(496)  评论(0编辑  收藏  举报

导航