You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "RusYus (via GitHub)" <gi...@apache.org> on 2026/03/23 16:44:22 UTC

[I] Cfg file no more watched after reconfiguration [logging-log4cxx]

RusYus opened a new issue, #612:
URL: https://github.com/apache/logging-log4cxx/issues/612

   If `DOMConfigurator::configureAndWatch()` called more than ones no XMLWatchdog thread is created.
   This happens because when old xdog is deleted it removes task in its dtor, so old thread in `ThreadUtility::priv_data::doPeriodicTasks()` finishes since jobs list is empty. On the next configuration new thread isn't created in `ThreadUtility::addPeriodicTask` because the old thread is joinable, so code goes to `m_priv->interrupt.notify_one();` which does nothing.
   
   Minimal code example to see if the watcher is running:
   
   ```
   #include <iostream>
   #include <log4cxx/logger.h>
   #include <log4cxx/xml/domconfigurator.h>
   #include <log4cxx/logmanager.h>
   
   static auto logger = log4cxx::Logger::getLogger("MyApp");
   
   int main()
   {
       log4cxx::xml::DOMConfigurator::configureAndWatch((std::string)"c:\\tmp\\log4cxx.xml");
   
       int c = std::getchar();
       while (c != 'q')
       {
           if (c == 'c')
           {
               std::cout << "configure\n";
               log4cxx::xml::DOMConfigurator::configureAndWatch((std::string)"c:\\tmp\\log4cxx.xml");
           }
   
           c = std::getchar();
       }
   
       log4cxx::LogManager::shutdown();
   
       return 0;
   }
   ```


-- 
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-unsubscribe@logging.apache.org.apache.org

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


Re: [I] Cfg file no more watched after reconfiguration [logging-log4cxx]

Posted by "swebb2066 (via GitHub)" <gi...@apache.org>.
swebb2066 commented on issue #612:
URL: https://github.com/apache/logging-log4cxx/issues/612#issuecomment-4114749944

   > If DOMConfigurator::configureAndWatch() called more than once
   
   This problem was resolved in commit 86ea0a77c (released in Aug-2025 as 1.5.0) where xdog deletion was removed from  `DOMConfigurator::configureAndWatch`
   
   > new thread isn't created in ThreadUtility::addPeriodicTask because the old thread is joinable
   
   The old thread being joinable is a problem, but only occurs when using `DOMConfigurator::configureAndWatch` after calling `LogManager::shutdown`
   


-- 
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-unsubscribe@logging.apache.org

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


Re: [I] Cfg file no more watched after reconfiguration [logging-log4cxx]

Posted by "swebb2066 (via GitHub)" <gi...@apache.org>.
swebb2066 closed issue #612: Cfg file no more watched after reconfiguration
URL: https://github.com/apache/logging-log4cxx/issues/612


-- 
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-unsubscribe@logging.apache.org

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