Browse Source

Upgrade to Logback 1.5.7

Closes gh-41887
pull/41910/head
Andy Wilkinson 1 year ago
parent
commit
dd2ed5f12d
  1. 2
      spring-boot-project/spring-boot-dependencies/build.gradle
  2. 6
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/DefaultLogbackConfiguration.java
  3. 3
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackConfigurator.java
  4. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java
  5. 1
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/SpringBootJoranConfiguratorTests.java

2
spring-boot-project/spring-boot-dependencies/build.gradle

@ -1121,7 +1121,7 @@ bom { @@ -1121,7 +1121,7 @@ bom {
releaseNotes("https://github.com/apache/logging-log4j2/releases/tag/rel%2F{version}")
}
}
library("Logback", "1.5.6") {
library("Logback", "1.5.7") {
group("ch.qos.logback") {
modules = [
"logback-classic",

6
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/DefaultLogbackConfiguration.java

@ -54,7 +54,8 @@ class DefaultLogbackConfiguration { @@ -54,7 +54,8 @@ class DefaultLogbackConfiguration {
}
void apply(LogbackConfigurator config) {
synchronized (config.getConfigurationLock()) {
config.getConfigurationLock().lock();
try {
defaults(config);
Appender<ILoggingEvent> consoleAppender = consoleAppender(config);
if (this.logFile != null) {
@ -65,6 +66,9 @@ class DefaultLogbackConfiguration { @@ -65,6 +66,9 @@ class DefaultLogbackConfiguration {
config.root(Level.INFO, consoleAppender);
}
}
finally {
config.getConfigurationLock().unlock();
}
}
private void defaults(LogbackConfigurator config) {

3
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackConfigurator.java

@ -18,6 +18,7 @@ package org.springframework.boot.logging.logback; @@ -18,6 +18,7 @@ package org.springframework.boot.logging.logback;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
@ -49,7 +50,7 @@ class LogbackConfigurator { @@ -49,7 +50,7 @@ class LogbackConfigurator {
return this.context;
}
Object getConfigurationLock() {
ReentrantLock getConfigurationLock() {
return this.context.getConfigurationLock();
}

2
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java

@ -237,6 +237,7 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem implements BeanF @@ -237,6 +237,7 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem implements BeanF
: new LogbackConfigurator(context);
new DefaultLogbackConfiguration(logFile).apply(configurator);
context.setPackagingDataEnabled(true);
context.start();
});
}
@ -256,6 +257,7 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem implements BeanF @@ -256,6 +257,7 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem implements BeanF
catch (Exception ex) {
throw new IllegalStateException("Could not initialize Logback logging from " + location, ex);
}
loggerContext.start();
});
reportConfigurationErrorsIfNecessary(loggerContext);
}

1
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/SpringBootJoranConfiguratorTests.java

@ -73,6 +73,7 @@ class SpringBootJoranConfiguratorTests { @@ -73,6 +73,7 @@ class SpringBootJoranConfiguratorTests {
void reset() {
this.context.stop();
new BasicConfigurator().configure((LoggerContext) LoggerFactory.getILoggerFactory());
this.context.start();
}
@Test

Loading…
Cancel
Save