parent
cca5516ab0
commit
dd2ed5f12d
|
@ -1121,7 +1121,7 @@ bom {
|
||||||
releaseNotes("https://github.com/apache/logging-log4j2/releases/tag/rel%2F{version}")
|
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") {
|
group("ch.qos.logback") {
|
||||||
modules = [
|
modules = [
|
||||||
"logback-classic",
|
"logback-classic",
|
||||||
|
|
|
@ -54,7 +54,8 @@ class DefaultLogbackConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply(LogbackConfigurator config) {
|
void apply(LogbackConfigurator config) {
|
||||||
synchronized (config.getConfigurationLock()) {
|
config.getConfigurationLock().lock();
|
||||||
|
try {
|
||||||
defaults(config);
|
defaults(config);
|
||||||
Appender<ILoggingEvent> consoleAppender = consoleAppender(config);
|
Appender<ILoggingEvent> consoleAppender = consoleAppender(config);
|
||||||
if (this.logFile != null) {
|
if (this.logFile != null) {
|
||||||
|
@ -65,6 +66,9 @@ class DefaultLogbackConfiguration {
|
||||||
config.root(Level.INFO, consoleAppender);
|
config.root(Level.INFO, consoleAppender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
config.getConfigurationLock().unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void defaults(LogbackConfigurator config) {
|
private void defaults(LogbackConfigurator config) {
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.springframework.boot.logging.logback;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
import ch.qos.logback.classic.Level;
|
import ch.qos.logback.classic.Level;
|
||||||
import ch.qos.logback.classic.Logger;
|
import ch.qos.logback.classic.Logger;
|
||||||
|
@ -49,7 +50,7 @@ class LogbackConfigurator {
|
||||||
return this.context;
|
return this.context;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object getConfigurationLock() {
|
ReentrantLock getConfigurationLock() {
|
||||||
return this.context.getConfigurationLock();
|
return this.context.getConfigurationLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,6 +237,7 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem implements BeanF
|
||||||
: new LogbackConfigurator(context);
|
: new LogbackConfigurator(context);
|
||||||
new DefaultLogbackConfiguration(logFile).apply(configurator);
|
new DefaultLogbackConfiguration(logFile).apply(configurator);
|
||||||
context.setPackagingDataEnabled(true);
|
context.setPackagingDataEnabled(true);
|
||||||
|
context.start();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,6 +257,7 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem implements BeanF
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
throw new IllegalStateException("Could not initialize Logback logging from " + location, ex);
|
throw new IllegalStateException("Could not initialize Logback logging from " + location, ex);
|
||||||
}
|
}
|
||||||
|
loggerContext.start();
|
||||||
});
|
});
|
||||||
reportConfigurationErrorsIfNecessary(loggerContext);
|
reportConfigurationErrorsIfNecessary(loggerContext);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ class SpringBootJoranConfiguratorTests {
|
||||||
void reset() {
|
void reset() {
|
||||||
this.context.stop();
|
this.context.stop();
|
||||||
new BasicConfigurator().configure((LoggerContext) LoggerFactory.getILoggerFactory());
|
new BasicConfigurator().configure((LoggerContext) LoggerFactory.getILoggerFactory());
|
||||||
|
this.context.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue