You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by pk...@apache.org on 2022/09/03 08:31:17 UTC
[logging-log4j2] 07/07: [LOG4J2-3583] Add tests from #1022 and release notes
This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit d34e6b0f720f90ce0f98a831736ca2c7f6136557
Author: Piotr P. Karwasz <pi...@karwasz.org>
AuthorDate: Sat Sep 3 08:34:19 2022 +0200
[LOG4J2-3583] Add tests from #1022 and release notes
---
.../test/java/org/apache/logging/slf4j/LoggerTest.java | 16 ++++++++++++++++
src/changes/changes.xml | 3 +++
2 files changed, 19 insertions(+)
diff --git a/log4j-slf4j20-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java b/log4j-slf4j20-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java
index 1701bbcbc7..c8fe9d3f24 100644
--- a/log4j-slf4j20-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java
+++ b/log4j-slf4j20-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java
@@ -118,6 +118,22 @@ public class LoggerTest {
verify("List", "o.a.l.s.LoggerTest Debug message MDC{}" + Strings.LINE_SEPARATOR);
}
+ @Test
+ public void mdcStack() {
+ MDC.pushByKey("TestYear", "2010");
+ logger.debug("Debug message");
+ verify("List", "o.a.l.s.LoggerTest Debug message MDC{TestYear=2010}" + Strings.LINE_SEPARATOR);
+ MDC.pushByKey("TestYear", "2011");
+ logger.debug("Debug message");
+ verify("List", "o.a.l.s.LoggerTest Debug message MDC{TestYear=2011}" + Strings.LINE_SEPARATOR);
+ MDC.popByKey("TestYear");
+ logger.debug("Debug message");
+ verify("List", "o.a.l.s.LoggerTest Debug message MDC{TestYear=2010}" + Strings.LINE_SEPARATOR);
+ MDC.clear();
+ logger.debug("Debug message");
+ verify("List", "o.a.l.s.LoggerTest Debug message MDC{}" + Strings.LINE_SEPARATOR);
+ }
+
/**
* @see <a href="https://issues.apache.org/jira/browse/LOG4J2-793">LOG4J2-793</a>
*/
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index d0c13ef574..a47c7b7d3e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -232,6 +232,9 @@
<action issue="LOG4J2-3559" dev="pkarwasz" type="fix" due-to="Gary Gregory">
Fix resolution of properties not starting with `log4j2.`.
</action>
+ <action issue="LOG4J2-3583" dev="pkarwasz" type="add" due-to="Pierrick Terrettaz">
+ Add support for SLF4J2 stack-valued MDC.
+ </action>
</release>
<release version="2.18.0" date="20YY-06-28" description="GA Release 2.18.0">
<action issue="LOG4J2-3339" dev="rgoers" type="fix">