commit
901feadc25
|
|
@ -176,7 +176,7 @@ public class JavaLoggingSystem extends AbstractLoggingSystem {
|
|||
/**
|
||||
* {@link LoggingSystemFactory} that returns {@link JavaLoggingSystem} if possible.
|
||||
*/
|
||||
@Order(Ordered.LOWEST_PRECEDENCE)
|
||||
@Order(Ordered.LOWEST_PRECEDENCE - 1024)
|
||||
public static class Factory implements LoggingSystemFactory {
|
||||
|
||||
private static final boolean PRESENT = ClassUtils.isPresent("java.util.logging.LogManager",
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ import org.springframework.boot.logging.LoggingInitializationContext;
|
|||
import org.springframework.boot.logging.LoggingSystem;
|
||||
import org.springframework.boot.logging.LoggingSystemFactory;
|
||||
import org.springframework.core.Conventions;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
|
@ -505,7 +504,7 @@ public class Log4J2LoggingSystem extends AbstractLoggingSystem {
|
|||
/**
|
||||
* {@link LoggingSystemFactory} that returns {@link Log4J2LoggingSystem} if possible.
|
||||
*/
|
||||
@Order(Ordered.LOWEST_PRECEDENCE)
|
||||
@Order(0)
|
||||
public static class Factory implements LoggingSystemFactory {
|
||||
|
||||
private static final boolean PRESENT = ClassUtils
|
||||
|
|
|
|||
|
|
@ -492,7 +492,7 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem implements BeanF
|
|||
/**
|
||||
* {@link LoggingSystemFactory} that returns {@link LogbackLoggingSystem} if possible.
|
||||
*/
|
||||
@Order(Ordered.LOWEST_PRECEDENCE)
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE + 1024)
|
||||
public static class Factory implements LoggingSystemFactory {
|
||||
|
||||
private static final boolean PRESENT = ClassUtils.isPresent("ch.qos.logback.classic.LoggerContext",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2025 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.
|
||||
|
|
@ -20,7 +20,10 @@ import org.junit.jupiter.api.AfterEach;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.logging.LoggingSystem.NoOpLoggingSystem;
|
||||
import org.springframework.boot.logging.java.JavaLoggingSystem;
|
||||
import org.springframework.boot.logging.log4j2.Log4J2LoggingSystem;
|
||||
import org.springframework.boot.logging.logback.LogbackLoggingSystem;
|
||||
import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
|
@ -42,6 +45,18 @@ class LoggingSystemTests {
|
|||
assertThat(LoggingSystem.get(getClass().getClassLoader())).isInstanceOf(LogbackLoggingSystem.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ClassPathExclusions("logback-*.jar")
|
||||
void log4j2IsUsedInTheAbsenceOfLogback() {
|
||||
assertThat(LoggingSystem.get(getClass().getClassLoader())).isInstanceOf(Log4J2LoggingSystem.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ClassPathExclusions({ "logback-*.jar", "log4j-*.jar" })
|
||||
void julIsUsedInTheAbsenceOfLogbackAndLog4j2() {
|
||||
assertThat(LoggingSystem.get(getClass().getClassLoader())).isInstanceOf(JavaLoggingSystem.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void loggingSystemCanBeDisabled() {
|
||||
System.setProperty(LoggingSystem.SYSTEM_PROPERTY, LoggingSystem.NONE);
|
||||
|
|
|
|||
Loading…
Reference in New Issue