[
https://issues.apache.org/jira/browse/LOG4J2-1511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16078713#comment-16078713
]
ASF GitHub Bot commented on LOG4J2-1511:
----------------------------------------
Github user garydgregory commented on the issue:
https://github.com/apache/logging-log4j2/pull/40
@surukuntu : Would you be so kind as to verify and close if master is up to
snuff?
I think this was covered by commit 0c9c9f384475af3402833e9a2a27e97248b84b38:
```
commit 0c9c9f384475af3402833e9a2a27e97248b84b38
Author: Gary Gregory <[email protected]> 2016-08-26 22:14:47
Committer: Gary Gregory <[email protected]> 2016-08-26 22:14:47
Parent: 13feb49a0a6576fc835db9fae79b0aab297c5730 (Format nits.)
Child: 498bdb579a42c52542caf650bb4929dbf80ac8cc (LOG4J2-1010
DynamicThresholdFilter should get context data from the configured
ContextDataInjector, not hard-coded from ThreadContext)
Branches: GenericMapMessage, GenericMapMessageSimple, LOG4J2-1558,
LOG4J2-1597, LOG4J2-1651, LOG4J2-1685, Lucene5, ggregory-LOG4J2-1685, master,
origin/GenericMapMessage, origin/GenericMapMessageSimple, origin/HEAD,
origin/LOG4J2-1359, origin/LOG4J2-1390, origin/LOG4J2-1431, origin/LOG4J2-1442,
origin/LOG4J2-1576-revapi, origin/LOG4J2-1651, origin/LOG4J2-1661,
origin/LOG4J2-1685, origin/LOG4J2-1889, origin/LOG4J2-1958 and 6 more branches
[LOG4J2-1511] DynamicThresholdFilter filters incorrectly when params are
passed as individual arguments instead of varargs.
```
And yes I messed up the Git Author field.
> DynamicThresholdFilter filters incorrectly when params are passed as
> individual arguments instead of varargs
> ------------------------------------------------------------------------------------------------------------
>
> Key: LOG4J2-1511
> URL: https://issues.apache.org/jira/browse/LOG4J2-1511
> Project: Log4j 2
> Issue Type: Bug
> Affects Versions: 2.6.2
> Reporter: Srikanth
> Fix For: 2.7
>
>
> The below test should summarize the issue.
> {code}
> package org.apache.logging.log4j.core.filter;
> import static org.junit.Assert.assertSame;
> import static org.junit.Assert.assertTrue;
> import org.apache.logging.log4j.Level;
> import org.apache.logging.log4j.ThreadContext;
> import org.apache.logging.log4j.core.Filter;
> import org.apache.logging.log4j.core.LoggerContext;
> import org.apache.logging.log4j.core.util.KeyValuePair;
> import org.apache.logging.log4j.status.StatusLogger;
> import org.junit.After;
> import org.junit.Test;
> /**
> *
> */
> public class DynamicThresholdFilterTest {
> @After
> public void cleanup() {
> final LoggerContext ctx = LoggerContext.getContext(false);
> ctx.reconfigure();
> StatusLogger.getLogger().reset();
> }
> @Test
> public void testFilter() {
> ThreadContext.put("userid", "testuser");
> ThreadContext.put("organization", "apache");
> final KeyValuePair[] pairs = new KeyValuePair[] {
> new KeyValuePair("testuser", "DEBUG"),
> new KeyValuePair("JohnDoe", "warn") };
> final DynamicThresholdFilter filter =
> DynamicThresholdFilter.createFilter("userid", pairs, Level.ERROR,
> Filter.Result.ACCEPT, Filter.Result.NEUTRAL);
> filter.start();
> assertTrue(filter.isStarted());
> Object [] replacements = {"one", "two", "three"};
> assertSame(Filter.Result.ACCEPT, filter.filter(null, Level.DEBUG,
> null, "some test message", replacements)); // Works
> assertSame(Filter.Result.ACCEPT, filter.filter(null, Level.DEBUG,
> null, "some test message", "one", "two", "three")); // Doesn't work but it
> should
> ThreadContext.clearMap();
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)