Skip to content

Commit c9833d7

Browse files
committed
Merge branch '3.3.x'
Closes gh-41892
2 parents f78ec43 + 68d600e commit c9833d7

File tree

6 files changed

+15
-4
lines changed

6 files changed

+15
-4
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: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.boot.logging.logback;
1818

1919
import java.nio.charset.Charset;
20+
import java.util.concurrent.locks.ReentrantLock;
2021

2122
import ch.qos.logback.classic.Level;
2223
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
@@ -51,6 +52,7 @@
5152
* @author Scott Frederick
5253
* @author Jonatan Ivanov
5354
* @author Moritz Halbritter
55+
* @author Mark Chesney
5456
*/
5557
class DefaultLogbackConfiguration {
5658

@@ -80,7 +82,9 @@ class DefaultLogbackConfiguration {
8082
}
8183

8284
void apply(LogbackConfigurator config) {
83-
synchronized (config.getConfigurationLock()) {
85+
ReentrantLock lock = config.getConfigurationLock();
86+
lock.lock();
87+
try {
8488
defaults(config);
8589
Appender<ILoggingEvent> consoleAppender = consoleAppender(config);
8690
if (this.logFile != null) {
@@ -91,6 +95,9 @@ void apply(LogbackConfigurator config) {
9195
config.root(Level.INFO, consoleAppender);
9296
}
9397
}
98+
finally {
99+
lock.unlock();
100+
}
94101
}
95102

96103
private void defaults(LogbackConfigurator config) {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -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/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemParallelInitializationTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class LogbackLoggingSystemParallelInitializationTests {
4545
void cleanUp() {
4646
this.loggingSystem.cleanUp();
4747
((LoggerContext) LoggerFactory.getILoggerFactory()).stop();
48+
((LoggerContext) LoggerFactory.getILoggerFactory()).reset();
4849
}
4950

5051
@Test

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ void cleanUp() {
127127
System.getProperties().keySet().retainAll(this.systemPropertyNames);
128128
this.loggingSystem.cleanUp();
129129
((LoggerContext) LoggerFactory.getILoggerFactory()).stop();
130+
((LoggerContext) LoggerFactory.getILoggerFactory()).reset();
130131
}
131132

132133
@Test

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
@@ -72,6 +72,7 @@ void setup(CapturedOutput output) {
7272
@AfterEach
7373
void reset() {
7474
this.context.stop();
75+
this.context.reset();
7576
new BasicConfigurator().configure((LoggerContext) LoggerFactory.getILoggerFactory());
7677
}
7778

0 commit comments

Comments
 (0)