1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.classic.sift;
15
16 import ch.qos.logback.classic.ClassicConstants;
17 import ch.qos.logback.classic.spi.ILoggingEvent;
18 import ch.qos.logback.core.joran.spi.DefaultClass;
19 import ch.qos.logback.core.sift.Discriminator;
20 import ch.qos.logback.core.sift.SiftingAppenderBase;
21
22 import java.util.List;
23
24 import org.slf4j.Marker;
25
26
27
28
29
30
31
32
33
34
35
36 public class SiftingAppender extends SiftingAppenderBase<ILoggingEvent> {
37
38 @Override
39 protected long getTimestamp(ILoggingEvent event) {
40 return event.getTimeStamp();
41 }
42
43 @Override
44 @DefaultClass(MDCBasedDiscriminator.class)
45 public void setDiscriminator(Discriminator<ILoggingEvent> discriminator) {
46 super.setDiscriminator(discriminator);
47 }
48
49 protected boolean eventMarksEndOfLife(ILoggingEvent event) {
50 List<Marker> markers = event.getMarkerList();
51 if (markers == null)
52 return false;
53
54 for(Marker m: markers) {
55 if(m.contains(ClassicConstants.FINALIZE_SESSION_MARKER))
56 return true;
57 }
58 return false;
59 }
60 }