25
25
import ch .qos .logback .core .CoreConstants ;
26
26
import ch .qos .logback .core .boolex .JaninoEventEvaluatorBase ;
27
27
import ch .qos .logback .core .boolex .Matcher ;
28
+ import org .slf4j .Marker ;
28
29
29
30
public class JaninoEventEvaluator extends JaninoEventEvaluatorBase <ILoggingEvent > {
30
31
@@ -47,7 +48,8 @@ public class JaninoEventEvaluator extends JaninoEventEvaluatorBase<ILoggingEvent
47
48
DEFAULT_PARAM_NAME_LIST .add ("loggerContext" );
48
49
DEFAULT_PARAM_NAME_LIST .add ("level" );
49
50
DEFAULT_PARAM_NAME_LIST .add ("timeStamp" );
50
- // DEFAULT_PARAM_NAME_LIST.add("markerList");
51
+ DEFAULT_PARAM_NAME_LIST .add ("marker" );
52
+ DEFAULT_PARAM_NAME_LIST .add ("markerList" );
51
53
DEFAULT_PARAM_NAME_LIST .add ("mdc" );
52
54
DEFAULT_PARAM_NAME_LIST .add ("throwableProxy" );
53
55
DEFAULT_PARAM_NAME_LIST .add ("throwable" );
@@ -64,7 +66,8 @@ public class JaninoEventEvaluator extends JaninoEventEvaluatorBase<ILoggingEvent
64
66
DEFAULT_PARAM_TYPE_LIST .add (LoggerContextVO .class );
65
67
DEFAULT_PARAM_TYPE_LIST .add (int .class );
66
68
DEFAULT_PARAM_TYPE_LIST .add (long .class );
67
- // DEFAULT_PARAM_TYPE_LIST.add(List.class);
69
+ DEFAULT_PARAM_TYPE_LIST .add (Marker .class );
70
+ DEFAULT_PARAM_TYPE_LIST .add (MarkerList .class );
68
71
DEFAULT_PARAM_TYPE_LIST .add (Map .class );
69
72
DEFAULT_PARAM_TYPE_LIST .add (IThrowableProxy .class );
70
73
DEFAULT_PARAM_TYPE_LIST .add (Throwable .class );
@@ -123,7 +126,12 @@ protected Object[] getParameterValues(ILoggingEvent loggingEvent) {
123
126
// // In order to avoid NullPointerException, we could push a dummy marker if
124
127
// // the event's marker is null. However, this would surprise user who
125
128
// // expect to see a null marker instead of a dummy one.
126
- // values[i++] = loggingEvent.getMarkerList();
129
+
130
+ MarkerList markerList = new MarkerList (loggingEvent .getMarkerList ());
131
+ Marker marker = markerList .getFirstMarker ();
132
+ values [i ++] = marker ;
133
+ values [i ++] = markerList ;
134
+
127
135
values [i ++] = loggingEvent .getMDCPropertyMap ();
128
136
129
137
IThrowableProxy iThrowableProxy = loggingEvent .getThrowableProxy ();
@@ -146,5 +154,4 @@ protected Object[] getParameterValues(ILoggingEvent loggingEvent) {
146
154
147
155
return values ;
148
156
}
149
-
150
157
}
0 commit comments