rgoers opened a new issue, #1799:
URL: https://github.com/apache/logging-log4j2/issues/1799

   ## Description
   
   This issue is captured in 
https://github.com/spring-projects/spring-boot/issues/33450. During shutdown 
properties are being accessed, which causes the Spring Property Source to be 
invoked. However, it needs an active LoggerContext to work.
   
   ## Configuration
   
   **Version:** 2.20.0
   
   
   ## Logs
   
   ```
   [Stacktraces, errors, etc. relevant applications logs.]
   ```
   
   ## Reproduction
   
   While building a sample Spring Boot app I ran into a similar, but related, 
error.
   
   WARN StatusConsoleListener Unable to register Log4j shutdown hook because 
JVM is shutting down. Using SimpleLogger
   Exception in thread "SpringApplicationShutdownHook" 
java.lang.ClassCastException: class 
org.apache.logging.log4j.simple.SimpleLoggerContext cannot be cast to class 
org.apache.logging.log4j.core.LoggerContext 
(org.apache.logging.log4j.simple.SimpleLoggerContext and 
org.apache.logging.log4j.core.LoggerContext are in unnamed module of loader 
org.springframework.boot.loader.LaunchedURLClassLoader @5b480cf9)
        at 
org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.getLoggerContext(Log4J2LoggingSystem.java:480)
        at 
org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.lambda$getShutdownHandler$2(Log4J2LoggingSystem.java:452)
        at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at 
org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:110)
        at java.base/java.lang.Thread.run(Thread.java:833)
   
   We have seen this in other cases but have never come up with a permanent 
solution. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to