[ https://issues.apache.org/jira/browse/LOG4J2-1911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16020503#comment-16020503 ]
Jerry Chin commented on LOG4J2-1911: ------------------------------------ [~garydgregory] can you tell where I can supply a patch? > DynamicThresholdFilter defaultThreshold is not used to compare against > event's level when there's no matching key found. > ------------------------------------------------------------------------------------------------------------------------ > > Key: LOG4J2-1911 > URL: https://issues.apache.org/jira/browse/LOG4J2-1911 > Project: Log4j 2 > Issue Type: Bug > Components: Filters > Affects Versions: 2.8.2 > Reporter: Jerry Chin > Priority: Minor > Labels: documentation, patch > > The {{defaultThreshold}} property is not honored as documented : > {quote} > defaultThreshold Level of messages to be filtered. If there is no > matching key in the key/value pairs then this level will be compared against > the event's level. > {quote} > after carefully examining the source code, I found the following code is > called: > {code:title=DynamicThresholdFilter.java|borderStyle=solid} > private Result filter(Level level, ReadOnlyStringMap contextMap) { > String value = (String)contextMap.getValue(this.key); > if(value != null) { > Level ctxLevel = (Level)this.levelMap.get(value); > if(ctxLevel == null) { > ctxLevel = this.defaultThreshold; > } > return > level.isMoreSpecificThan(ctxLevel)?this.onMatch:this.onMismatch; > } else { > return Result.NEUTRAL; > } > } > {code} > where level is the event's level, when there's no matching key found > {{contextMap}}, {{Result.NEUTRAL}} is mistakenly returned, instead of against > {{this.defaultThreshold}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)