You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* This filter returns the {@code onMatch} result if the level in the {@code LogEvent} is in the range of the configured
33
-
* min and max levels, otherwise it returns {@code onMismatch} value . For example, if the filter is configured with
34
-
* {@link Level#ERROR} and {@link Level#INFO} and the LogEvent contains {@link Level#WARN} then the onMatch value will
35
-
* be returned since {@link Level#WARN WARN} events are in between {@link Level#ERROR ERROR} and {@link Level#INFO
36
-
* INFO}.
32
+
* This filter returns the {@link #onMatch} result if the level of the {@link LogEvent} is in the range of the configured {@link #minLevel} and {@link #maxLevel} values, otherwise it returns the {@link #onMismatch} result.
33
+
* The default values for {@link #minLevel} and {@link #maxLevel} are set to {@link Level#OFF} and {@link Level#ALL}, respectively.
34
+
* The default values for {@link #onMatch} and {@link #onMismatch} are set to {@link Result#NEUTRAL} and {@link Result#DENY}, respectively.
37
35
* <p>
38
-
* The default Levels are both {@link Level#ERROR ERROR}.
36
+
* The levels get compared by their associated integral values; {@link Level#OFF} has an integral value of 0, {@link Level#FATAL} 100, {@link Level#ERROR} 200, and so on.
37
+
* For example, if the filter is configured with {@link #maxLevel} set to {@link Level#INFO}, the filter will return {@link #onMismatch} result for {@link LogEvent}s of level with higher integral values; {@link Level#DEBUG}, {@link Level#TRACE}, etc.
@@ -224,6 +225,55 @@ Here is a sample configuration containing the DynamicThresholdFilter:
224
225
</Configuration>
225
226
----
226
227
228
+
[#LevelRangeFilter]
229
+
== LevelRangeFilter
230
+
231
+
`LevelRangeFilter` allows filtering against a level range, where levels get compared by their associated integral values; `OFF` has an integral value of 0, `FATAL` 100, `ERROR` 200, and so on.
232
+
233
+
.`LevelRangeFilter` parameters
234
+
[cols="1m,1m,4"]
235
+
|===
236
+
|Parameter Name |Type |Description
237
+
238
+
|minLevel
239
+
|Level
240
+
|the minimum level threshold (defaults to `OFF`, which has an integral value of 0)
241
+
242
+
|maxLevel
243
+
|Level
244
+
|the maximum level threshold (defaults to `ALL`, which has an integral value of `Integer.MAX_VALUE`)
245
+
246
+
|onMatch
247
+
|Filter.Result
248
+
|the result to return on a match, where allowed values are `ACCEPT`, `DENY`, or `NEUTRAL` (default)
249
+
250
+
|onMismatch
251
+
|Filter.Result
252
+
|the result to return on a mismatch, where allowed values are `ACCEPT`, `DENY` (default), or `NEUTRAL`
253
+
|===
254
+
255
+
In the following example configuration, a `LevelRangeFilter` is configured with `maxLevel` set to `INFO`.
256
+
The filter will return `onMismatch` result (i.e., `DENY`, the default) for log events of level with higher integral values than `INFO`; i.e., `DEBUG`, `TRACE`, etc.
0 commit comments