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

   ## Description
   
   
   My project is deployed using docker, and `log4j.xml` is placed in the 
configuration center instead of locally. Use `logging.config=./conf/log4j2.xml` 
to specify the configuration file
   
   When using `2.24.3`, log4j2 works normally, but when using `2.25.0`, there 
is no log output.
   
   log write configuration is load, but log4j not work. 
   
   I tried to compare it with version 2.24.3 and found that there might be a 
problem
   
   2.25.0 lacks the `setConfiguration` call, which causes the loaded 
configuration to not take effect.
   ```java
   // 2.25.0
   public void start(final Configuration config) {
       LOGGER.info("Starting {}[name={}] with configuration {}...", 
getClass().getSimpleName(), getName(), config);
       if (configLock.tryLock()) {
           try {
               if (this.isInitialized() || this.isStopped()) {
                   setStarting();
                   reconfigure(config);
                   if (this.configuration.isShutdownHookEnabled()) {
                       setUpShutdownHook();
                   }
                   this.setStarted();
               }
           } finally {
               configLock.unlock();
           }
       }
       LOGGER.info("{}[name={}] started with configuration {}.", 
getClass().getSimpleName(), getName(), config);
   }
   
   // 2.24.3
   public void start(final Configuration config) {
       LOGGER.info("Starting {}[name={}] with configuration {}...", 
getClass().getSimpleName(), getName(), config);
       if (configLock.tryLock()) {
           try {
               if (this.isInitialized() || this.isStopped()) {
                   if (this.configuration.isShutdownHookEnabled()) {
                       setUpShutdownHook();
                   }
                   this.setStarted();
               }
           } finally {
               configLock.unlock();
           }
       }
       setConfiguration(config);
       LOGGER.info("{}[name={}] started with configuration {}.", 
getClass().getSimpleName(), getName(), config);
   }
   ```
   
   **Version:** 
   spring boot version: 2.7.18
   log4j2 version: 2.25.0
   
   **Operating system:** linux
   
   **JDK:** jdk17
   
   ## Logs
   
   ```
   2025-07-08T07:42:04.861760Z main DEBUG Loaded configuration from 
/Users/xxx/src/zzz/conf/log4j2.xml
   2025-07-08T07:42:06.402691Z main INFO Starting LoggerContext[name=76ed5528] 
with configuration 
XmlConfiguration[location=/Users/xxx/src/zzz/conf/log4j2.xml, 
lastModified=2025-07-08T07:42:02.425Z]...
   2025-07-08T07:42:06.403729Z main INFO LoggerContext[name=76ed5528] started 
with configuration 
XmlConfiguration[location=/Users/xxx/src/zzz/conf/log4j2.xml, 
lastModified=2025-07-08T07:42:02.425Z].
   .
   ```
   
   ## Reproduction


-- 
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