This is an automated email from the ASF dual-hosted git repository. reta pushed a commit to branch 4.0.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 42f5b96c2dcec0f17640fbb940d2ecb36ea7766f 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) (cherry picked from commit a52e4bcf3be3fbf1862d738d5498ad6e74839872) --- 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();
