Upgrade to Logback 1.5.7
See gh-41885
This commit is contained in:
committed by
Stéphane Nicoll
parent
d4762eca22
commit
f09d645136
@@ -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",
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.boot.logging.logback;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
|
||||
@@ -44,6 +45,7 @@ import org.springframework.boot.logging.LogFile;
|
||||
* @author Robert Thornton
|
||||
* @author Scott Frederick
|
||||
* @author Jonatan Ivanov
|
||||
* @author Mark Chesney
|
||||
*/
|
||||
class DefaultLogbackConfiguration {
|
||||
|
||||
@@ -54,7 +56,9 @@ class DefaultLogbackConfiguration {
|
||||
}
|
||||
|
||||
void apply(LogbackConfigurator config) {
|
||||
synchronized (config.getConfigurationLock()) {
|
||||
ReentrantLock lock = config.getConfigurationLock();
|
||||
lock.lock();
|
||||
try {
|
||||
defaults(config);
|
||||
Appender<ILoggingEvent> consoleAppender = consoleAppender(config);
|
||||
if (this.logFile != null) {
|
||||
@@ -65,6 +69,9 @@ class DefaultLogbackConfiguration {
|
||||
config.root(Level.INFO, consoleAppender);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private void defaults(LogbackConfigurator config) {
|
||||
|
||||
@@ -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;
|
||||
@@ -35,6 +36,7 @@ import org.springframework.util.Assert;
|
||||
* Allows programmatic configuration of logback which is usually faster than parsing XML.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Mark Chesney
|
||||
*/
|
||||
class LogbackConfigurator {
|
||||
|
||||
@@ -49,7 +51,7 @@ class LogbackConfigurator {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
Object getConfigurationLock() {
|
||||
ReentrantLock getConfigurationLock() {
|
||||
return this.context.getConfigurationLock();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* control over how and when the logging system is initialized.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @author Mark Chesney
|
||||
*/
|
||||
class LogbackLoggingSystemParallelInitializationTests {
|
||||
|
||||
@@ -45,6 +46,7 @@ class LogbackLoggingSystemParallelInitializationTests {
|
||||
void cleanUp() {
|
||||
this.loggingSystem.cleanUp();
|
||||
((LoggerContext) LoggerFactory.getILoggerFactory()).stop();
|
||||
((LoggerContext) LoggerFactory.getILoggerFactory()).reset();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -44,6 +44,7 @@ import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.slf4j.ILoggerFactory;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.MDC;
|
||||
@@ -93,8 +94,9 @@ import static org.mockito.Mockito.times;
|
||||
* @author Scott Frederick
|
||||
* @author Jonatan Ivanov
|
||||
* @author Moritz Halbritter
|
||||
* @author Mark Chesney
|
||||
*/
|
||||
@ExtendWith(OutputCaptureExtension.class)
|
||||
@ExtendWith({ MockitoExtension.class, OutputCaptureExtension.class })
|
||||
@ClassPathExclusions({ "log4j-core-*.jar", "log4j-api-*.jar" })
|
||||
class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
||||
|
||||
@@ -128,6 +130,7 @@ class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
||||
System.getProperties().keySet().retainAll(this.systemPropertyNames);
|
||||
this.loggingSystem.cleanUp();
|
||||
((LoggerContext) LoggerFactory.getILoggerFactory()).stop();
|
||||
((LoggerContext) LoggerFactory.getILoggerFactory()).reset();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -43,6 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Phillip Webb
|
||||
* @author Eddú Meléndez
|
||||
* @author Stephane Nicoll
|
||||
* @author Mark Chesney
|
||||
*/
|
||||
@ExtendWith(OutputCaptureExtension.class)
|
||||
class SpringBootJoranConfiguratorTests {
|
||||
@@ -72,6 +73,7 @@ class SpringBootJoranConfiguratorTests {
|
||||
@AfterEach
|
||||
void reset() {
|
||||
this.context.stop();
|
||||
this.context.reset();
|
||||
new BasicConfigurator().configure((LoggerContext) LoggerFactory.getILoggerFactory());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user