From 7e4defbcba0033e24df0596b0da6541545963d9e Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 1 Jun 2021 15:14:24 +0200 Subject: [PATCH] Properly guard LogbackLoggingSystem Previously, LoggingSystem#get would chose Logback by the sole presence of a class in logback-core, with the assumption that logback-classic is also on the classpath. An app that only had the former would therefore fail. This commit updates the condition to check for a class in logback-classic instead. Closes gh-26711 --- .../java/org/springframework/boot/logging/LoggingSystem.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java index d906e29336..403c18d0ec 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2021 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. @@ -60,7 +60,8 @@ public abstract class LoggingSystem { static { Map systems = new LinkedHashMap<>(); - systems.put("ch.qos.logback.core.Appender", "org.springframework.boot.logging.logback.LogbackLoggingSystem"); + systems.put("ch.qos.logback.classic.LoggerContext", + "org.springframework.boot.logging.logback.LogbackLoggingSystem"); systems.put("org.apache.logging.log4j.core.impl.Log4jContextFactory", "org.springframework.boot.logging.log4j2.Log4J2LoggingSystem"); systems.put("java.util.logging.LogManager", "org.springframework.boot.logging.java.JavaLoggingSystem");