You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ck...@apache.org on 2021/08/04 15:07:21 UTC
[logging-log4j2] branch master updated: LOG4J2-3133:
log4j-slf4j-impl provides new singleton accessors from slf4j-api 1.7.14
This is an automated email from the ASF dual-hosted git repository.
ckozak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/master by this push:
new 28cd40e LOG4J2-3133: log4j-slf4j-impl provides new singleton accessors from slf4j-api 1.7.14
28cd40e is described below
commit 28cd40e6bec0212d2744e639558706c3a4d82246
Author: Carter Kozak <ck...@apache.org>
AuthorDate: Wed Aug 4 10:34:13 2021 -0400
LOG4J2-3133: log4j-slf4j-impl provides new singleton accessors from slf4j-api 1.7.14
See https://github.com/qos-ch/slf4j/commit/ea3cca72cd5a9329a06b788317a17e806ee8acd0
and https://jira.qos.ch/browse/SLF4J-347
---
.../src/main/java/org/slf4j/impl/StaticMDCBinder.java | 9 +++++++++
.../src/main/java/org/slf4j/impl/StaticMarkerBinder.java | 9 +++++++++
src/changes/changes.xml | 5 +++++
3 files changed, 23 insertions(+)
diff --git a/log4j-slf4j-impl/src/main/java/org/slf4j/impl/StaticMDCBinder.java b/log4j-slf4j-impl/src/main/java/org/slf4j/impl/StaticMDCBinder.java
index c6e395d..eb46620 100644
--- a/log4j-slf4j-impl/src/main/java/org/slf4j/impl/StaticMDCBinder.java
+++ b/log4j-slf4j-impl/src/main/java/org/slf4j/impl/StaticMDCBinder.java
@@ -33,6 +33,15 @@ public final class StaticMDCBinder {
}
/**
+ * Returns the {@link #SINGLETON} {@link StaticMDCBinder}.
+ * Added to slf4j-api 1.7.14 via https://github.com/qos-ch/slf4j/commit/ea3cca72cd5a9329a06b788317a17e806ee8acd0
+ * @return the singleton instance
+ */
+ public static StaticMDCBinder getSingleton() {
+ return SINGLETON;
+ }
+
+ /**
* Currently this method always returns an instance of {@link StaticMDCBinder}.
* @return an MDC adapter
*/
diff --git a/log4j-slf4j-impl/src/main/java/org/slf4j/impl/StaticMarkerBinder.java b/log4j-slf4j-impl/src/main/java/org/slf4j/impl/StaticMarkerBinder.java
index e255120..35091ac 100644
--- a/log4j-slf4j-impl/src/main/java/org/slf4j/impl/StaticMarkerBinder.java
+++ b/log4j-slf4j-impl/src/main/java/org/slf4j/impl/StaticMarkerBinder.java
@@ -33,6 +33,15 @@ public class StaticMarkerBinder implements MarkerFactoryBinder {
private final IMarkerFactory markerFactory = new Log4jMarkerFactory();
+ /**
+ * Returns the {@link #SINGLETON} {@link StaticMarkerBinder}.
+ * Added to slf4j-api 1.7.14 via https://github.com/qos-ch/slf4j/commit/ea3cca72cd5a9329a06b788317a17e806ee8acd0
+ * @return the singleton instance
+ */
+ public static StaticMarkerBinder getSingleton() {
+ return SINGLETON;
+ }
+
@Override
public IMarkerFactory getMarkerFactory() {
return markerFactory;
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a848ede..00363de 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -170,6 +170,11 @@
</release>
<release version="2.15.0" date="2021-MM-DD" description="GA Release 2.15.0">
<!-- ADDS -->
+ <action issue="LOG4J2-3133" dev="ckozak" type="add">
+ Add missing slf4j-api singleton accessors to log4j-slf4j-impl (1.7) StaticMarkerBinder and StaticMDCBinder.
+ This doesn't impact behavior or correctness, but avoids throwing and catching NoSuchMethodErrors when slf4j
+ is initialized and avoids linkage linting warnings.
+ </action>
<action issue="LOG4J2-2885" dev="vy" type="add" due-to="Markus Spann">
Add support for US-style date patterns and micro/nano seconds to FixedDateTime.
</action>