Pluto-syd opened a new issue, #2614:
URL: https://github.com/apache/logging-log4j2/issues/2614

   ## Description
   
   When obtaining the LogContext through 
LogManager.getContext(getClass().getClassLoader(), false, uri), the 
shutdownHook in the XML configuration does not take effect.
   
   ## Configuration
   <Configuration name="ConfigTest" status="DEBUG" monitorInterval="5" 
shutdownHook="disable">
   
   </Configuration>
   
   **Version:** [Log4j version]
   2.22.1
   
   **Operating system:** [OS and version]
   macos
   
   **JDK:** [JDK distribution and version]
   jdk21
   ## Logs
   DEBUG StatusConsoleListener Starting LoggerContext[name=4e0e2f2a] from 
configuration at 
file:/Users/syd/dev-code/git-dev/java-samples/utils-sample/src/test/resources/demo.xml
   DEBUG StatusConsoleListener Starting LoggerContext[name=4e0e2f2a, 
org.apache.logging.log4j.core.LoggerContext@304bb45b] with configuration 
XmlConfiguration[location=/Users/syd/dev-code/git-dev/java-samples/utils-sample/src/test/resources/demo.xml]...
   DEBUG StatusConsoleListener Shutdown hook enabled. Registering a new one.
   DEBUG StatusConsoleListener Apache Log4j Core 2.22 initializing 
configuration 
XmlConfiguration[location=/Users/syd/dev-code/git-dev/java-samples/utils-sample/src/test/resources/demo.xml]
   DEBUG StatusConsoleListener PluginManager 'Core' found 131 plugins
   DEBUG StatusConsoleListener PluginManager 'Level' found 0 plugins
   DEBUG StatusConsoleListener PluginManager 'Lookup' found 16 plugins
   WARN StatusConsoleListener No Loggers were configured, using default. Is the 
Loggers element missing?
   DEBUG StatusConsoleListener PluginManager 'Converter' found 45 plugins
   DEBUG StatusConsoleListener Starting OutputStreamManager 
SYSTEM_OUT.false.false-2
   DEBUG StatusConsoleListener Configuration 
XmlConfiguration[location=/Users/syd/dev-code/git-dev/java-samples/utils-sample/src/test/resources/demo.xml]
 initialized
   DEBUG StatusConsoleListener Starting configuration 
XmlConfiguration[location=/Users/syd/dev-code/git-dev/java-samples/utils-sample/src/test/resources/demo.xml]
   DEBUG StatusConsoleListener Log4j2 ConfigurationScheduler starting 1 threads
   DEBUG StatusConsoleListener Started configuration 
XmlConfiguration[location=/Users/syd/dev-code/git-dev/java-samples/utils-sample/src/test/resources/demo.xml]
 OK.
   DEBUG StatusConsoleListener Shutting down OutputStreamManager 
SYSTEM_OUT.false.false-1
   DEBUG StatusConsoleListener OutputStream closed
   DEBUG StatusConsoleListener Shut down OutputStreamManager 
SYSTEM_OUT.false.false-1, all resources released: true
   DEBUG StatusConsoleListener Appender DefaultConsole-1 stopped with status 
true
   DEBUG StatusConsoleListener Stopped 
org.apache.logging.log4j.core.config.DefaultConfiguration@4e096385 OK
   DEBUG StatusConsoleListener Registering MBean 
org.apache.logging.log4j2:type=4e0e2f2a
   DEBUG StatusConsoleListener Registering MBean 
org.apache.logging.log4j2:type=4e0e2f2a,component=StatusLogger
   DEBUG StatusConsoleListener Registering MBean 
org.apache.logging.log4j2:type=4e0e2f2a,component=ContextSelector
   DEBUG StatusConsoleListener Registering MBean 
org.apache.logging.log4j2:type=4e0e2f2a,component=Appenders,name=DefaultConsole-2
   DEBUG StatusConsoleListener org.apache.logging.log4j.core.util.SystemClock 
supports precise timestamps.
   DEBUG StatusConsoleListener LoggerContext[name=4e0e2f2a, 
org.apache.logging.log4j.core.LoggerContext@304bb45b] started OK with 
configuration 
XmlConfiguration[location=/Users/syd/dev-code/git-dev/java-samples/utils-sample/src/test/resources/demo.xml].
   org.apache.logging.log4j.core.LoggerContext@304bb45b
   DEBUG StatusConsoleListener Stopping LoggerContext[name=4e0e2f2a, 
org.apache.logging.log4j.core.LoggerContext@304bb45b]
   DEBUG StatusConsoleListener Stopping LoggerContext[name=4e0e2f2a, 
org.apache.logging.log4j.core.LoggerContext@304bb45b]...
   DEBUG StatusConsoleListener Shutting down OutputStreamManager 
SYSTEM_OUT.false.false-2
   DEBUG StatusConsoleListener OutputStream closed
   DEBUG StatusConsoleListener Shut down OutputStreamManager 
SYSTEM_OUT.false.false-2, all resources released: true
   DEBUG StatusConsoleListener Appender DefaultConsole-2 stopped with status 
true
   DEBUG StatusConsoleListener Log4j2 ConfigurationScheduler shutting down 
threads in java.util.concurrent.ScheduledThreadPoolExecutor@2a8448fa[Running, 
pool size = 1, active threads = 0, queued tasks = 1, completed tasks = 0]
   DEBUG StatusConsoleListener Stopped 
XmlConfiguration[location=/Users/syd/dev-code/git-dev/java-samples/utils-sample/src/test/resources/demo.xml]
 OK
   DEBUG StatusConsoleListener Stopped LoggerContext[name=4e0e2f2a, 
org.apache.logging.log4j.core.LoggerContext@304bb45b] with status true
   ```
   [Stacktraces, errors, etc. relevant applications logs.]
   ```
   
   ## Reproduction
   
   [An isolated test reproducing the test.
   JUnit tests similar to the ones in the code base are extremely appreciated.]
   @Test
       void log4j2(){
           File file = new 
File("/Users/syd/dev-code/git-dev/java-samples/utils-sample/src/test/resources/demo.xml");
           URI uri = file.toURI();
           LoggerContext context = 
LogManager.getContext(getClass().getClassLoader(), false, uri);
       }
   


-- 
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: notifications-unsubscr...@logging.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to