This is an automated email from the ASF dual-hosted git repository.

vy pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/release-2.x by this push:
     new 5bc48cc9b4 LOG4J2-3188 Create a fresh LoggerContext in 
JsonTemplateLayoutConcurrentEncodeTest.
5bc48cc9b4 is described below

commit 5bc48cc9b49b291cb1f41b84fcd1ff2965fa7cf2
Author: Volkan Yazıcı <[email protected]>
AuthorDate: Sun Sep 18 21:56:23 2022 +0200

    LOG4J2-3188 Create a fresh LoggerContext in 
JsonTemplateLayoutConcurrentEncodeTest.
---
 .../template/json/JsonTemplateLayoutConcurrentEncodeTest.java  | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git 
a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutConcurrentEncodeTest.java
 
b/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutConcurrentEncodeTest.java
index 5a52785465..f5e7039635 100644
--- 
a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutConcurrentEncodeTest.java
+++ 
b/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutConcurrentEncodeTest.java
@@ -20,14 +20,11 @@ import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.LoggerContext;
 import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.config.Configurator;
 import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilder;
 import 
org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFactory;
 import org.apache.logging.log4j.core.layout.ByteBufferDestination;
 import org.apache.logging.log4j.core.layout.StringBuilderEncoder;
 import org.apache.logging.log4j.util.Strings;
-import org.junit.jupiter.api.parallel.Execution;
-import org.junit.jupiter.api.parallel.ExecutionMode;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
 
@@ -55,9 +52,6 @@ import static org.assertj.core.api.Assertions.assertThat;
  * </p>
  */
 @SuppressWarnings("SameParameterValue")
-// Running tests in parallel is causing strange issues at the Log4j 
configuration level.
-// Falling back to sequential test run for the moment.
-@Execution(ExecutionMode.SAME_THREAD)
 class JsonTemplateLayoutConcurrentEncodeTest {
 
     @ParameterizedTest
@@ -133,7 +127,9 @@ class JsonTemplateLayoutConcurrentEncodeTest {
                 .build(false);
 
         // Initialize the configuration and pass it to the consumer.
-        try (final LoggerContext loggerContext = 
Configurator.initialize(config)) {
+        final String loggerContextName = String.format("LC-%s", 
appenderFilepath);
+        try (final LoggerContext loggerContext = new 
LoggerContext(loggerContextName)) {
+            loggerContext.reconfigure(config);
             loggerContextConsumer.accept(loggerContext);
         }
 

Reply via email to