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: [email protected]

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

Reply via email to