-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Labels
status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply
Description
Issue can be reproduced using spring-boot-sample-logback and the following patch (Logback 1.1.6 is required to avoid NPE on reloadDefaultConfiguration, see qos-ch/logback#302):
diff --git spring-boot-samples/spring-boot-sample-logback/pom.xml spring-boot-samples/spring-boot-sample-logback/pom.xml
index 34efcd6..836a052 100644
--- spring-boot-samples/spring-boot-sample-logback/pom.xml
+++ spring-boot-samples/spring-boot-sample-logback/pom.xml
@@ -17,6 +17,7 @@
</organization>
<properties>
<main.basedir>${basedir}/../..</main.basedir>
+ <logback.version>1.1.6</logback.version>
</properties>
<dependencies>
<dependency>
diff --git spring-boot-samples/spring-boot-sample-logback/src/main/java/sample/logback/SampleLogbackApplication.java spring-boot-samples/spring-boot-sample-logback/src/main/java/sample/logback/SampleLogbackApplication.java
index 058fe1a..8569507 100644
--- spring-boot-samples/spring-boot-sample-logback/src/main/java/sample/logback/SampleLogbackApplication.java
+++ spring-boot-samples/spring-boot-sample-logback/src/main/java/sample/logback/SampleLogbackApplication.java
@@ -16,21 +16,22 @@
package sample.logback;
-import javax.annotation.PostConstruct;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+@EnableScheduling
@SpringBootApplication
public class SampleLogbackApplication {
private static final Logger logger = LoggerFactory
.getLogger(SampleLogbackApplication.class);
- @PostConstruct
+ @Scheduled(fixedDelay = 5000)
public void logSomething() {
logger.debug("Sample Debug Message");
logger.trace("Sample Trace Message");
diff --git spring-boot-samples/spring-boot-sample-logback/src/main/resources/logback-spring.xml spring-boot-samples/spring-boot-sample-logback/src/main/resources/logback-spring.xml
index e279b82..638b4c4 100644
--- spring-boot-samples/spring-boot-sample-logback/src/main/resources/logback-spring.xml
+++ spring-boot-samples/spring-boot-sample-logback/src/main/resources/logback-spring.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
+ <jmxConfigurator/>
<include resource="org/springframework/boot/logging/logback/base.xml" />
<logger name="sample.logback" level="DEBUG" />
<springProfile name="staging">Start the sample app, execute reloadDefaultConfiguration operation via JMX. The following output is logged:
21:33:08,445 |-INFO in ch.qos.logback.classic.jmx.JMXConfigurator(default) - Resetting context: default
21:33:08,445 |-INFO in ch.qos.logback.classic.jmx.JMXConfigurator(default) - onReset() method called JMXActivator [ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator]
After that no further events are logged.
The problem is that there's no LoggerContextListener that would've notified logging system of reset operation and trigger the re-initialization.
Metadata
Metadata
Assignees
Labels
status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply