Upgrade to Logback 1.5.7

Closes gh-41887
This commit is contained in:
Andy Wilkinson 2024-08-16 20:20:23 +01:00
parent cca5516ab0
commit dd2ed5f12d
5 changed files with 11 additions and 3 deletions

View File

@ -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",

View File

@ -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 {
config.root(Level.INFO, consoleAppender);
}
}
finally {
config.getConfigurationLock().unlock();
}
}
private void defaults(LogbackConfigurator config) {

View File

@ -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 {
return this.context;
}
Object getConfigurationLock() {
ReentrantLock getConfigurationLock() {
return this.context.getConfigurationLock();
}

View File

@ -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
catch (Exception ex) {
throw new IllegalStateException("Could not initialize Logback logging from " + location, ex);
}
loggerContext.start();
});
reportConfigurationErrorsIfNecessary(loggerContext);
}

View File

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