Skip to content

Commit 09e119b

Browse files
committed
Merge branch '3.3.x'
Closes gh-41892
2 parents 77089a1 + dd2ed5f commit 09e119b

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
@@ -1141,7 +1141,7 @@ bom {
11411141
releaseNotes("https://github.com/apache/logging-log4j2/releases/tag/rel%2F{version}")
11421142
}
11431143
}
1144-
library("Logback", "1.5.6") {
1144+
library("Logback", "1.5.7") {
11451145
group("ch.qos.logback") {
11461146
modules = [
11471147
"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
@@ -80,7 +80,8 @@ class DefaultLogbackConfiguration {
8080
}
8181

8282
void apply(LogbackConfigurator config) {
83-
synchronized (config.getConfigurationLock()) {
83+
config.getConfigurationLock().lock();
84+
try {
8485
defaults(config);
8586
Appender<ILoggingEvent> consoleAppender = consoleAppender(config);
8687
if (this.logFile != null) {
@@ -91,6 +92,9 @@ void apply(LogbackConfigurator config) {
9192
config.root(Level.INFO, consoleAppender);
9293
}
9394
}
95+
finally {
96+
config.getConfigurationLock().unlock();
97+
}
9498
}
9599

96100
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
@@ -240,6 +240,7 @@ protected void loadDefaults(LoggingInitializationContext initializationContext,
240240
: new LogbackConfigurator(loggerContext);
241241
new DefaultLogbackConfiguration(logFile).apply(configurator);
242242
loggerContext.setPackagingDataEnabled(true);
243+
loggerContext.start();
243244
});
244245
}
245246

@@ -260,6 +261,7 @@ protected void loadConfiguration(LoggingInitializationContext initializationCont
260261
catch (Exception ex) {
261262
throw new IllegalStateException("Could not initialize Logback logging from " + location, ex);
262263
}
264+
loggerContext.start();
263265
});
264266
reportConfigurationErrorsIfNecessary(loggerContext);
265267
}

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)