diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 09c785792b6..5dc7fc35ea1 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -813,7 +813,7 @@ bom { ] } } - library("Logback", "1.3.0-alpha15") { + library("Logback", "1.2.11") { group("ch.qos.logback") { modules = [ "logback-access", @@ -1289,7 +1289,7 @@ bom { ] } } - library("SLF4J", "2.0.0-alpha7") { + library("SLF4J", "1.7.36") { group("org.slf4j") { modules = [ "jcl-over-slf4j", diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LogbackInitializer.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LogbackInitializer.java index e3229edd61a..29be5dcd9ba 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LogbackInitializer.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LogbackInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ package org.springframework.boot.loader.tools; import ch.qos.logback.classic.Level; import org.slf4j.ILoggerFactory; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.slf4j.impl.StaticLoggerBinder; import org.springframework.util.ClassUtils; @@ -32,7 +32,7 @@ import org.springframework.util.ClassUtils; public abstract class LogbackInitializer { public static void initialize() { - if (ClassUtils.isPresent("org.slf4j.LoggerFactory", null) + if (ClassUtils.isPresent("org.slf4j.impl.StaticLoggerBinder", null) && ClassUtils.isPresent("ch.qos.logback.classic.Logger", null)) { new Initializer().setRootLogLevel(); } @@ -41,7 +41,7 @@ public abstract class LogbackInitializer { private static class Initializer { void setRootLogLevel() { - ILoggerFactory factory = LoggerFactory.getILoggerFactory(); + ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory(); Logger logger = factory.getLogger(Logger.ROOT_LOGGER_NAME); ((ch.qos.logback.classic.Logger) logger).setLevel(Level.INFO); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java index 39df27a15f2..0fde1b977c6 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java @@ -39,9 +39,9 @@ import ch.qos.logback.core.status.Status; import ch.qos.logback.core.util.StatusListenerConfigHelper; import org.slf4j.ILoggerFactory; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.slf4j.Marker; import org.slf4j.bridge.SLF4JBridgeHandler; +import org.slf4j.impl.StaticLoggerBinder; import org.springframework.boot.logging.AbstractLoggingSystem; import org.springframework.boot.logging.LogFile; @@ -348,7 +348,7 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem { } private LoggerContext getLoggerContext() { - ILoggerFactory factory = LoggerFactory.getILoggerFactory(); + ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory(); Assert.isInstanceOf(LoggerContext.class, factory, () -> String.format( "LoggerFactory is not a Logback LoggerContext but Logback is on "