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
This commit is contained in:
Stephane Nicoll 2021-06-01 15:14:24 +02:00
parent 647451087f
commit 7e4defbcba

View File

@ -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<String, String> 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");