1 package chapter6;
2
3 import ch.qos.logback.classic.spi.LoggingEvent;
4 import ch.qos.logback.core.filter.Filter;
5 import ch.qos.logback.core.spi.FilterReply;
6
7 public class SampleFilter extends Filter {
8
9 @Override
10 public FilterReply decide(Object eventObject) {
11 LoggingEvent event = (LoggingEvent)eventObject;
12 if (event.getMessage() != null && event.getMessage().contains("sample")) {
13 return FilterReply.ACCEPT;
14 } else {
15 return FilterReply.NEUTRAL;
16 }
17 }
18 }