Skip to content

Commit f070192

Browse files
rgoersmernstdependabot[bot]vyppkarwasz
authored
Logger context properties (#1473)
* Interim commit * More fixes * Everything builds * Fix `PatternLayout.Builder#withHeader()` javadoc (#1411) * Fix `SimpleDateFormat`-related JDK bug URL in `FastDateParser` javadoc (#1404) * Ensure `FileOutputStream` is closed in `CommonsCompressAction.execute()` (#1415) * Fix nullability docs in `StrSubstitutor` (#1422) * Change `{@literal null}` to `{@code null}` (#1424) * Remove deprecated docs from `PatternParser#extractConverter()` (#1423) * Bump actions/checkout from 3.4.0 to 3.5.2 (#1434) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.4.0 to 3.5.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@24cb908...8e5e7e5) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/setup-python from 4.3.0 to 4.6.0 (#1440) Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.3.0 to 4.6.0. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@13ae5bb...57ded4d) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * LOG4J2-3660 Fix `%notEmpty` for empty MDC/NDC inputs * LOG4J2-3660 Add `MdcPatternConverter` fixes missing from the cherry-pick * Prepare for formatting of all files Sometimes Spotless will not detect that a header already exists, e.g. if it is after a package declaration. * Apply Spotless * Bump github/codeql-action from 2.1.28 to 2.3.1 (#1452) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.28 to 2.3.1. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@cc7986c...8662eab) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump github/codeql-action from 2.3.1 to 2.3.2 (#1455) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.1 to 2.3.2. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@8662eab...f3feb00) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add Log4j Transform documentation Adds a documentation page that forwards the user to Github. * Fix license header * Fix typo in `SECURITY.md` (#1457) * Bump logging-parent from 8 to 9 By bumping to logging-parent 9, we remove the explicit Spotless configuration. * Rebase with main * Trying to rebase from main * Provide LoggerContext properties during configuration --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Michael Ernst <[email protected]> Co-authored-by: Michael Ernst <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Volkan Yazıcı <[email protected]> Co-authored-by: Piotr P. Karwasz <[email protected]> Co-authored-by: spotless[bot] <[email protected]> Co-authored-by: Michael Scovetta <[email protected]>
1 parent db05f81 commit f070192

File tree

209 files changed

+3448
-1656
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+3448
-1656
lines changed

log4j-1.2-api/src/test/java/org/apache/log4j/CategoryTest.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import org.apache.log4j.spi.LoggingEvent;
2929
import org.apache.logging.log4j.core.Layout;
3030
import org.apache.logging.log4j.core.LogEvent;
31-
import org.apache.logging.log4j.core.config.ConfigurationFactory;
31+
import org.apache.logging.log4j.core.impl.Log4jPropertyKey;
3232
import org.apache.logging.log4j.core.layout.PatternLayout;
3333
import org.apache.logging.log4j.core.test.appender.ListAppender;
3434
import org.apache.logging.log4j.message.MapMessage;
@@ -59,13 +59,14 @@ public class CategoryTest {
5959
public static void setupClass() {
6060
appender.start();
6161
version1Appender.setName(VERSION1_APPENDER_NAME);
62-
System.setProperty(ConfigurationFactory.CONFIGURATION_FACTORY_PROPERTY, BasicConfigurationFactory.class.getName());
62+
System.setProperty(Log4jPropertyKey.CONFIG_CONFIGURATION_FACTORY_CLASS_NAME.getSystemKey(),
63+
BasicConfigurationFactory.class.getName());
6364
}
6465

6566
@AfterAll
6667
public static void cleanupClass() {
6768
appender.stop();
68-
System.clearProperty(ConfigurationFactory.CONFIGURATION_FACTORY_PROPERTY);
69+
System.clearProperty(Log4jPropertyKey.CONFIG_CONFIGURATION_FACTORY_CLASS_NAME.getSystemKey());
6970
}
7071

7172
@BeforeEach

log4j-1.2-api/src/test/java/org/apache/log4j/LoggerTest.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import org.apache.logging.log4j.core.LogEvent;
2525
import org.apache.logging.log4j.core.LoggerContext;
2626
import org.apache.logging.log4j.core.appender.AbstractAppender;
27-
import org.apache.logging.log4j.core.config.ConfigurationFactory;
2827
import org.apache.logging.log4j.core.config.Property;
28+
import org.apache.logging.log4j.core.impl.Log4jPropertyKey;
2929
import org.apache.logging.log4j.core.layout.PatternLayout;
3030
import org.apache.logging.log4j.core.test.appender.ListAppender;
3131
import org.junit.jupiter.api.AfterAll;
@@ -66,12 +66,13 @@ public static void setUpClass() {
6666
rbCH = ResourceBundle.getBundle("L7D", new Locale("fr", "CH"));
6767
assertNotNull(rbCH, "Got a null resource bundle.");
6868

69-
System.setProperty(ConfigurationFactory.CONFIGURATION_FACTORY_PROPERTY, BasicConfigurationFactory.class.getName());
69+
System.setProperty(Log4jPropertyKey.CONFIG_CONFIGURATION_FACTORY_CLASS_NAME.getSystemKey(),
70+
BasicConfigurationFactory.class.getName());
7071
}
7172

7273
@AfterAll
7374
public static void tearDownClass() {
74-
System.clearProperty(ConfigurationFactory.CONFIGURATION_FACTORY_PROPERTY);
75+
System.clearProperty(Log4jPropertyKey.CONFIG_CONFIGURATION_FACTORY_CLASS_NAME.getSystemKey());
7576
}
7677

7778
@AfterEach

log4j-1.2-api/src/test/java/org/apache/log4j/config/PropertiesConfigurationFactoryTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public class PropertiesConfigurationFactoryTest {
3333

3434
@BeforeClass
3535
public static void beforeClass() {
36-
System.setProperty(ConfigurationFactory.LOG4J1_CONFIGURATION_FILE_PROPERTY, "target/test-classes/log4j1-file-1.properties");
36+
System.setProperty(ConfigurationFactory.LOG4J1_CONFIGURATION_FILE_PROPERTY.getSystemKey(),
37+
"target/test-classes/log4j1-file-1.properties");
3738
}
3839

3940
@Test

log4j-1.2-api/src/test/java/org/apache/log4j/config/XmlConfigurationFactoryTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public class XmlConfigurationFactoryTest {
3333

3434
@BeforeClass
3535
public static void beforeClass() {
36-
System.setProperty(ConfigurationFactory.LOG4J1_CONFIGURATION_FILE_PROPERTY, "target/test-classes/log4j1-file.xml");
36+
System.setProperty(ConfigurationFactory.LOG4J1_CONFIGURATION_FILE_PROPERTY.getSystemKey(),
37+
"target/test-classes/log4j1-file.xml");
3738
}
3839
@Test
3940
public void testXML() {

log4j-api-test/src/main/java/org/apache/logging/log4j/test/junit/TestPropertySource.java

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package org.apache.logging.log4j.test.junit;
1818

19+
1920
import org.apache.logging.log4j.test.TestProperties;
2021
import org.apache.logging.log4j.util.PropertySource;
2122
import org.junit.jupiter.api.extension.ExtensionContext;

log4j-api-test/src/test/java/org/apache/logging/log4j/NoopThreadContextTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
package org.apache.logging.log4j;
1818

19-
import org.apache.logging.log4j.spi.LoggingSystemProperties;
19+
import org.apache.logging.log4j.spi.LoggingSystemProperty;
2020
import org.apache.logging.log4j.test.junit.InitializesThreadContext;
2121
import org.apache.logging.log4j.test.junit.UsingThreadContextMap;
2222
import org.junit.jupiter.api.Test;
@@ -30,8 +30,8 @@
3030
public class NoopThreadContextTest {
3131

3232
@Test
33-
@SetSystemProperty(key = LoggingSystemProperties.THREAD_CONTEXT_DISABLED, value = "true")
34-
@SetSystemProperty(key = LoggingSystemProperties.THREAD_CONTEXT_MAP_DISABLED, value = "true")
33+
@SetSystemProperty(key = LoggingSystemProperty.Constant.THREAD_CONTEXT_ENABLED, value = "false")
34+
@SetSystemProperty(key = LoggingSystemProperty.Constant.THREAD_CONTEXT_MAP_ENABLED, value = "false")
3535
@InitializesThreadContext
3636
@UsingThreadContextMap
3737
public void testNoop() {

log4j-api-test/src/test/java/org/apache/logging/log4j/ThreadContextInheritanceTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package org.apache.logging.log4j;
1818

19+
import org.apache.logging.log4j.spi.LoggingSystemProperty;
1920
import org.apache.logging.log4j.test.ThreadContextUtilityClass;
2021
import org.apache.logging.log4j.test.junit.InitializesThreadContext;
2122
import org.apache.logging.log4j.test.junit.UsingThreadContextMap;
@@ -24,13 +25,12 @@
2425
import org.junit.jupiter.api.Test;
2526
import org.junitpioneer.jupiter.SetSystemProperty;
2627

27-
import static org.apache.logging.log4j.spi.LoggingSystemProperties.THREAD_CONTEXT_MAP_INHERITABLE;
2828
import static org.junit.jupiter.api.Assertions.*;
2929

3030
/**
3131
* Tests {@link ThreadContext}.
3232
*/
33-
@SetSystemProperty(key = THREAD_CONTEXT_MAP_INHERITABLE, value = "true")
33+
@SetSystemProperty(key = LoggingSystemProperty.Constant.THREAD_CONTEXT_MAP_INHERITABLE, value = "true")
3434
@InitializesThreadContext
3535
public class ThreadContextInheritanceTest {
3636

@@ -45,7 +45,7 @@ public void testPush() {
4545
}
4646

4747
@Test
48-
@SetSystemProperty(key = THREAD_CONTEXT_MAP_INHERITABLE, value = "true")
48+
@SetSystemProperty(key = LoggingSystemProperty.Constant.THREAD_CONTEXT_MAP_INHERITABLE, value = "true")
4949
@InitializesThreadContext
5050
public void testInheritanceSwitchedOn() throws Exception {
5151
ThreadContext.put("Greeting", "Hello");

log4j-api-test/src/test/java/org/apache/logging/log4j/test/junit/TestPropertySourceTest.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ public void testInjectedFields() {
3636

3737
// Test that per-class properties are overridden by per-test properties
3838
final PropertyEnvironment env = PropertiesUtil.getProperties();
39-
staticProperties.setProperty("log4j2.staticProperty", "static");
40-
staticProperties.setProperty("log4j2.instanceProperty", "static");
41-
instanceProperties.setProperty("log4j2.instanceProperty", "instance");
42-
assertThat(env.getStringProperty("log4j2.staticProperty")).isEqualTo("static");
43-
assertThat(env.getStringProperty("log4j.instanceProperty")).isEqualTo("instance");
39+
staticProperties.setProperty("static.Property", "static");
40+
staticProperties.setProperty("instance.Property", "static");
41+
instanceProperties.setProperty("instance.Property", "instance");
42+
assertThat(env.getStringProperty("static.Property")).isEqualTo("static");
43+
assertThat(env.getStringProperty("instance.Property")).isEqualTo("instance");
4444
}
4545

4646
@Test
@@ -49,9 +49,9 @@ public void testInjectedParameter(final TestProperties paramProperties) {
4949
}
5050

5151
@Test
52-
@SetTestProperty(key = "log4j2.testSetTestProperty", value = "true")
52+
@SetTestProperty(key = "test.SetTestProperty", value = "true")
5353
public void testSetTestProperty() {
5454
final PropertyEnvironment env = PropertiesUtil.getProperties();
55-
assertThat(env.getBooleanProperty("log4j2.testSetTestProperty")).isTrue();
55+
assertThat(env.getBooleanProperty("test.SetTestProperty")).isTrue();
5656
}
5757
}

log4j-api-test/src/test/java/org/apache/logging/log4j/util/EnvironmentPropertySourceTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ public class EnvironmentPropertySourceTest {
3131

3232
public static Object[][] data() {
3333
return new Object[][]{
34-
{"LOG4J_CONFIGURATION_FILE", Arrays.asList("configuration", "file")},
35-
{"LOG4J_FOO_BAR_PROPERTY", Arrays.asList("foo", "bar", "property")},
36-
{"LOG4J_EXACT", Collections.singletonList("EXACT")},
37-
{"LOG4J_TEST_PROPERTY_NAME", PropertySource.Util.tokenize("Log4jTestPropertyName")},
34+
{"CONFIGURATION_FILE", Arrays.asList("CONFIGURATION", "FILE")},
35+
{"LOG4J2_FOO_BAR_PROPERTY", Arrays.asList("LOG4J2", "FOO", "BAR", "PROPERTY")},
36+
{"LOG4J2_EXACT", Arrays.asList("LOG4J2", "EXACT")},
37+
{"LOG4J2_TEST_PROPERTY_NAME", Arrays.asList("LOG4J2", "TEST", "PROPERTY", "NAME")},
3838
{null, Collections.emptyList()}
3939
};
4040
}

log4j-api-test/src/test/java/org/apache/logging/log4j/util/LegacyPropertiesCompatibilityTest.java

+47-55
Original file line numberDiff line numberDiff line change
@@ -27,67 +27,59 @@ public class LegacyPropertiesCompatibilityTest {
2727

2828
public static Object[][] data() {
2929
return new Object[][]{
30-
{"log4j2.configurationFile", "log4j.configurationFile"},
31-
{"log4j2.mergeStrategy", "log4j.mergeStrategy"},
32-
{"log4j2.contextSelector", "Log4jContextSelector"},
33-
{"log4j2.logEventFactory", "Log4jLogEventFactory"},
34-
{"log4j2.configurationFactory", "log4j.configurationFactory"},
35-
{"log4j2.shutdownCallbackRegistry", "log4j.shutdownCallbackRegistry"},
36-
{"log4j2.clock", "log4j.Clock"},
37-
{"log4j2.level", "org.apache.logging.log4j.level"},
38-
{"log4j2.disableThreadContext", "disableThreadContext"},
39-
{"log4j2.disableThreadContextStack", "disableThreadContextStack"},
40-
{"log4j2.disableThreadContextMap", "disableThreadContextMap"},
41-
{"log4j2.isThreadContextMapInheritable", "isThreadContextMapInheritable"},
42-
{"log4j2.contextDataInjector", "log4j2.ContextDataInjector"},
43-
{"log4j2.garbagefreeThreadContextMap", "log4j2.garbagefree.threadContextMap"},
44-
{"log4j2.disableJmx", "log4j2.disable.jmx"},
45-
{"log4j2.jmxNotifyAsync", "log4j2.jmx.notify.async"},
46-
{"log4j2.skipJansi", "log4j.skipJansi"},
47-
{"log4j2.ignoreTCL", "log4j.ignoreTCL"},
48-
{"log4j2.ignoreTCL", "LOG4J_IGNORE_TCL"}, // just a sanity check for fun camel case names
49-
{"log4j2.uuidSequence", "org.apache.logging.log4j.uuidSequence"},
50-
{"log4j2.assignedSequences", "org.apache.logging.log4j.assignedSequences"},
51-
{"log4j2.simplelogShowContextMap", "org.apache.logging.log4j.simplelog.showContextMap"},
52-
{"log4j2.simplelogShowlogname", "org.apache.logging.log4j.simplelog.showlogname"},
53-
{"log4j2.simplelogShowShortLogname", "org.apache.logging.log4j.simplelog.showShortLogname"},
54-
{"log4j2.simplelogShowdatetime", "org.apache.logging.log4j.simplelog.showdatetime"},
55-
{"log4j2.simplelogDateTimeFormat", "org.apache.logging.log4j.simplelog.dateTimeFormat"},
56-
{"log4j2.simplelogLogFile", "org.apache.logging.log4j.simplelog.logFile"},
57-
{"log4j2.simplelogLevel", "org.apache.logging.log4j.simplelog.level"},
58-
{"log4j2.simplelog.com.foo.bar.Thing.level", "org.apache.logging.log4j.simplelog.com.foo.bar.Thing.level"},
59-
{"log4j2.simplelogComFooBarThingLevel", "org.apache.logging.log4j.simplelog.com.foo.bar.Thing.level"},
60-
{"log4j2.simplelogStatusLoggerLevel", "org.apache.logging.log4j.simplelog.StatusLogger.level"},
61-
{"log4j2.defaultStatusLevel", "Log4jDefaultStatusLevel"},
62-
{"log4j2.statusLoggerLevel", "log4j2.StatusLogger.level"},
63-
{"log4j2.statusEntries", "log4j2.status.entries"},
64-
{"log4j2.asyncLoggerExceptionHandler", "AsyncLogger.ExceptionHandler"},
65-
{"log4j2.asyncLoggerRingBufferSize", "AsyncLogger.RingBufferSize"},
66-
{"log4j2.asyncLoggerWaitStrategy", "AsyncLogger.WaitStrategy"},
67-
{"log4j2.asyncLoggerThreadNameStrategy", "AsyncLogger.ThreadNameStrategy"},
68-
{"log4j2.asyncLoggerConfigExceptionHandler", "AsyncLoggerConfig.ExceptionHandler"},
69-
{"log4j2.asyncLoggerConfigRingBufferSize", "AsyncLoggerConfig.RingBufferSize"},
70-
{"log4j2.asyncLoggerConfigWaitStrategy", "AsyncLoggerConfig.WaitStrategy"},
71-
{"log4j2.julLoggerAdapter", "log4j.jul.LoggerAdapter"},
72-
{"log4j2.formatMsgAsync", "log4j.format.msg.async"},
73-
{"log4j2.asyncQueueFullPolicy", "log4j2.AsyncQueueFullPolicy"},
74-
{"log4j2.discardThreshold", "log4j2.DiscardThreshold"},
75-
{"log4j2.isWebapp", "log4j2.is.webapp"},
76-
{"log4j2.enableThreadlocals", "log4j2.enable.threadlocals"},
77-
{"log4j2.enableDirectEncoders", "log4j2.enable.direct.encoders"},
78-
{"log4j2.initialReusableMsgSize", "log4j.initialReusableMsgSize"},
79-
{"log4j2.maxReusableMsgSize", "log4j.maxReusableMsgSize"},
80-
{"log4j2.layoutStringBuilderMaxSize", "log4j.layoutStringBuilder.maxSize"},
81-
{"log4j2.unboxRingbufferSize", "log4j.unbox.ringbuffer.size"},
82-
{"log4j2.loggerContextStacktraceOnStart", "log4j.LoggerContext.stacktrace.on.start"},
30+
{"log4j2.configurationFile", "Configuration.file"},
31+
{"log4j2.mergeStrategy", "Configuration.mergeStrategy"},
32+
{"log4j2.contextSelector", "LoggerContext.selector"},
33+
{"log4j2.logEventFactory", "Logger.logEventFactory"},
34+
{"log4j2.configurationFactory", "Configuration.factory"},
35+
{"log4j2.shutdownCallbackRegistry", "LoggerContext.shutdownCallbackRegistry"},
36+
{"log4j2.clock", "Configuration.clock"},
37+
{"log4j2.level", "Configuration.level"},
38+
{"log4j2.isThreadContextMapInheritable", "ThreadContext.inheritable"},
39+
{"log4j2.contextDataInjector", "ThreadContext.contextDataInjector"},
40+
{"log4j2.garbagefreeThreadContextMap", "ThreadContext.garbageFreeMap"},
41+
{"log4j2.jmxNotifyAsync", "JMX.notifyAsync"},
42+
{"log4j2.ignoreTCL", "Loader.ignoreTCL"},
43+
{"log4j2.uuidSequence", "UUID.sequence"},
44+
{"log4j2.assignedSequences", "UUID.assignedSequences"},
45+
{"log4j2.simplelogShowContextMap", "SimpleLogger.showContextMap"},
46+
{"log4j2.simplelogShowlogname", "SimpleLogger.showLogName"},
47+
{"log4j2.simplelogShowShortLogname", "SimpleLogger.showShortLogName"},
48+
{"log4j2.simplelogShowdatetime", "SimpleLogger.showDateTime"},
49+
{"log4j2.simplelogDateTimeFormat", "SimpleLogger.dateTimeFormat"},
50+
{"log4j2.simplelogLogFile", "SimpleLogger.logFile"},
51+
{"log4j2.simplelogLevel", "SimpleLogger.level"},
52+
{"log4j2.simplelogStatusLoggerLevel", "SimpleLogger.statusLoggerLevel"},
53+
{"log4j2.defaultStatusLevel", "StatusLogger.defaultLevel"},
54+
{"log4j2.statusLoggerLevel", "StatusLogger.level"},
55+
{"log4j2.statusEntries", "StatusLogger.entries"},
56+
{"log4j2.asyncLoggerExceptionHandler", "AsyncLogger.exceptionHandler"},
57+
{"log4j2.asyncLoggerRingBufferSize", "AsyncLogger.ringBufferSize"},
58+
{"log4j2.asyncLoggerWaitStrategy", "AsyncLogger.waitStrategy"},
59+
{"log4j2.asyncLoggerThreadNameStrategy", "AsyncLogger.threadNameStrategy"},
60+
{"log4j2.asyncLoggerConfigExceptionHandler", "AsyncLoggerConfig.exceptionHandler"},
61+
{"log4j2.asyncLoggerConfigRingBufferSize", "AsyncLoggerConfig.ringBufferSize"},
62+
{"log4j2.asyncLoggerConfigWaitStrategy", "AsyncLoggerConfig.waitStrategy"},
63+
{"log4j2.julLoggerAdapter", "JUL.loggerAdapter"},
64+
{"log4j2.formatMsgAsync", "AsyncLogger.formatMsg"},
65+
{"log4j2.asyncQueueFullPolicy", "AsyncLogger.queueFullPolicy"},
66+
{"log4j2.discardThreshold", "AsyncLogger.discardThreshold"},
67+
{"log4j2.isWebapp", "Web.isWebApp"},
68+
{"log4j2.enableThreadlocals", "ThreadLocals.enable"},
69+
{"log4j2.enableDirectEncoders", "GC.enableDirectEncoders"},
70+
{"log4j2.initialReusableMsgSize", "GC.initialReusableMsgSize"},
71+
{"log4j2.maxReusableMsgSize", "GC.maxReusableMsgSize"},
72+
{"log4j2.layoutStringBuilderMaxSize", "GC.layoutStringBuilderMaxSize"},
73+
{"log4j2.unboxRingbufferSize", "Unbox.ringBufferSize"},
74+
{"log4j2.loggerContextStacktraceOnStart", "LoggerContext.stackTraceOnStart"}
8375
};
8476
}
8577

8678
@ParameterizedTest
8779
@MethodSource("data")
88-
public void compareNewWithOldName(final String newName, final String oldName) {
80+
public void compareNewWithOldName(final String oldName, final String newName) {
8981
final List<CharSequence> newTokens = PropertySource.Util.tokenize(newName);
9082
final List<CharSequence> oldTokens = PropertySource.Util.tokenize(oldName);
91-
assertEquals(oldTokens, newTokens);
83+
assertEquals(newTokens, oldTokens);
9284
}
9385
}

log4j-api-test/src/test/java/org/apache/logging/log4j/util/PropertiesPropertySourceTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ public class PropertiesPropertySourceTest {
3232

3333
public static Object[][] data() {
3434
return new Object[][]{
35-
{"log4j2.configurationFile", Arrays.asList("configuration", "file")},
36-
{"log4j2.fooBarProperty", Arrays.asList("foo", "bar", "property")},
37-
{"log4j2.EXACT", Collections.singletonList("EXACT")},
38-
{"log4j2.testPropertyName", PropertySource.Util.tokenize("Log4jTestPropertyName")},
35+
{"log4j2.configuration.file", Arrays.asList("configuration", "file")},
36+
{"log4j2.foo.bar.property", Arrays.asList("foo", "bar", "property")},
37+
{"log4j2.LOWER", Collections.singletonList("LOWER")},
38+
{"log4j2.Log4jTestPropertyName", PropertySource.Util.tokenize("Log4jTestPropertyName")},
3939
{null, Collections.emptyList()}
4040
};
4141
}

0 commit comments

Comments
 (0)