This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/main by this push:
new a52e4bcf3b CXF-9094: Hard coded org.slf4j.impl.StaticLoggerBinder of
slf4j 1.x in LogUtils (#2220)
a52e4bcf3b is described below
commit a52e4bcf3be3fbf1862d738d5498ad6e74839872
Author: Andriy Redko <[email protected]>
AuthorDate: Sat Jan 11 09:01:46 2025 -0500
CXF-9094: Hard coded org.slf4j.impl.StaticLoggerBinder of slf4j 1.x in
LogUtils (#2220)
---
core/src/main/java/org/apache/cxf/common/logging/LogUtils.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/core/src/main/java/org/apache/cxf/common/logging/LogUtils.java
b/core/src/main/java/org/apache/cxf/common/logging/LogUtils.java
index 09727e68a3..3bf3cd64c7 100644
--- a/core/src/main/java/org/apache/cxf/common/logging/LogUtils.java
+++ b/core/src/main/java/org/apache/cxf/common/logging/LogUtils.java
@@ -98,7 +98,14 @@ public final class LogUtils {
// as we'll just use j.u.l and pax-logging will pick it up
fine
// If we don't call this and there isn't a slf4j impl
avail,
// you get warnings printed to stderr about NOPLoggers and
such
- Class.forName("org.slf4j.impl.StaticLoggerBinder");
+ try {
+ // SLF4J 2.x
+ Class.forName("org.slf4j.spi.SLF4JServiceProvider");
+ } catch (final ClassNotFoundException ex) {
+ // SLF4J 1.x
+ Class.forName("org.slf4j.impl.StaticLoggerBinder");
+ }
+
Class<?> cls = Class.forName("org.slf4j.LoggerFactory");
Class<?> fcls =
cls.getMethod("getILoggerFactory").invoke(null).getClass();
String clsName = fcls.getName();