Skip to content

Commit d659fd2

Browse files
committed
Revert "Scoped context (#2438)"
This reverts the changes that introduces `ScopedContext`.
1 parent 86676c7 commit d659fd2

File tree

52 files changed

+212
-3789
lines changed

Some content is hidden

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

52 files changed

+212
-3789
lines changed

log4j-api-test/pom.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
<bnd-module-name>org.apache.logging.log4j.test</bnd-module-name>
3838
<bnd-extra-package-options>
3939
org.apache.commons.lang3.*;resolution:=optional,
40-
org.assertj.*;resolution:=optional,
4140
<!-- Both JUnit 4 and JUnit 5 are not required -->
4241
org.junit.*;resolution:=optional,
4342
org.hamcrest.*;resolution:=optional,
@@ -49,7 +48,6 @@
4948
<bnd-extra-module-options>
5049
<!-- Non-transitive static modules -->
5150
junit;transitive=false,
52-
org.assertj.core;transitive=false,
5351
org.hamcrest;transitive=false,
5452
org.junit.jupiter.api;transitive=false,
5553
org.junitpioneer;transitive=false,
@@ -74,10 +72,6 @@
7472
<groupId>org.apache.logging.log4j</groupId>
7573
<artifactId>log4j-api</artifactId>
7674
</dependency>
77-
<dependency>
78-
<groupId>org.assertj</groupId>
79-
<artifactId>assertj-core</artifactId>
80-
</dependency>
8175
<dependency>
8276
<groupId>org.apache.commons</groupId>
8377
<artifactId>commons-lang3</artifactId>
@@ -114,6 +108,11 @@
114108
<groupId>org.codehaus.plexus</groupId>
115109
<artifactId>plexus-utils</artifactId>
116110
</dependency>
111+
<dependency>
112+
<groupId>org.assertj</groupId>
113+
<artifactId>assertj-core</artifactId>
114+
<scope>test</scope>
115+
</dependency>
117116
<!-- Required for JSON support -->
118117
<dependency>
119118
<groupId>com.fasterxml.jackson.core</groupId>

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.io.ByteArrayOutputStream;
2121
import java.io.PrintStream;
2222
import java.util.ArrayList;
23-
import java.util.HashMap;
2423
import java.util.List;
2524
import java.util.Map;
2625
import org.apache.logging.log4j.Level;
@@ -29,7 +28,6 @@
2928
import org.apache.logging.log4j.message.Message;
3029
import org.apache.logging.log4j.message.MessageFactory;
3130
import org.apache.logging.log4j.spi.AbstractLogger;
32-
import org.apache.logging.log4j.util.ProviderUtil;
3331

3432
/**
3533
*
@@ -81,12 +79,7 @@ protected void log(
8179
sb.append(' ');
8280
}
8381
sb.append(message.getFormattedMessage());
84-
final Map<String, ?> contextMap =
85-
ProviderUtil.getProvider().getScopedContextProvider().getContextMap();
86-
final Map<String, String> mdc = new HashMap<>(ThreadContext.getImmutableContext());
87-
if (contextMap != null && !contextMap.isEmpty()) {
88-
contextMap.forEach((key, value) -> mdc.put(key, value.toString()));
89-
}
82+
final Map<String, String> mdc = ThreadContext.getImmutableContext();
9083
if (!mdc.isEmpty()) {
9184
sb.append(' ');
9285
sb.append(mdc);

log4j-api-test/src/main/java/org/apache/logging/log4j/test/spi/ScopedContextProviderSuite.java

Lines changed: 0 additions & 178 deletions
This file was deleted.

0 commit comments

Comments
 (0)