Skip to content

Commit dd2ed5f

Browse files
committed
Upgrade to Logback 1.5.7
Closes gh-41887
1 parent cca5516 commit dd2ed5f

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ bom {
11211121
releaseNotes("https://github.com/apache/logging-log4j2/releases/tag/rel%2F{version}")
11221122
}
11231123
}
1124-
library("Logback", "1.5.6") {
1124+
library("Logback", "1.5.7") {
11251125
group("ch.qos.logback") {
11261126
modules = [
11271127
"logback-classic",

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ class DefaultLogbackConfiguration {
5454
}
5555

5656
void apply(LogbackConfigurator config) {
57-
synchronized (config.getConfigurationLock()) {
57+
config.getConfigurationLock().lock();
58+
try {
5859
defaults(config);
5960
Appender<ILoggingEvent> consoleAppender = consoleAppender(config);
6061
if (this.logFile != null) {
@@ -65,6 +66,9 @@ void apply(LogbackConfigurator config) {
6566
config.root(Level.INFO, consoleAppender);
6667
}
6768
}
69+
finally {
70+
config.getConfigurationLock().unlock();
71+
}
6872
}
6973

7074
private void defaults(LogbackConfigurator config) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.util.HashMap;
2020
import java.util.Map;
21+
import java.util.concurrent.locks.ReentrantLock;
2122

2223
import ch.qos.logback.classic.Level;
2324
import ch.qos.logback.classic.Logger;
@@ -49,7 +50,7 @@ LoggerContext getContext() {
4950
return this.context;
5051
}
5152

52-
Object getConfigurationLock() {
53+
ReentrantLock getConfigurationLock() {
5354
return this.context.getConfigurationLock();
5455
}
5556

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ protected void loadDefaults(LoggingInitializationContext initializationContext,
237237
: new LogbackConfigurator(context);
238238
new DefaultLogbackConfiguration(logFile).apply(configurator);
239239
context.setPackagingDataEnabled(true);
240+
context.start();
240241
});
241242
}
242243

@@ -256,6 +257,7 @@ protected void loadConfiguration(LoggingInitializationContext initializationCont
256257
catch (Exception ex) {
257258
throw new IllegalStateException("Could not initialize Logback logging from " + location, ex);
258259
}
260+
loggerContext.start();
259261
});
260262
reportConfigurationErrorsIfNecessary(loggerContext);
261263
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ void setup(CapturedOutput output) {
7373
void reset() {
7474
this.context.stop();
7575
new BasicConfigurator().configure((LoggerContext) LoggerFactory.getILoggerFactory());
76+
this.context.start();
7677
}
7778

7879
@Test

0 commit comments

Comments
 (0)