From: Václav H. <v.h...@sh...> - 2009-06-02 15:01:15
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Koller, Georg wrote: > Hello, > > when I use ConfigureAndWatchThread in my application and change the > configuration file, while my application is running, my application hangs. > Any ideas? > The code is printed below. > > Regards, > Georg > > > #include <log4cplus/logger.h> > #include <log4cplus/configurator.h> > > #include <unistd.h> > > using namespace log4cplus; > > int > main > (int argc, char* argv []) > { > ConfigureAndWatchThread > configureThread(LOG4CPLUS_TEXT("logger.properties"), 5 * 1000); > > Logger log1 = Logger::getInstance("test.log_1"); > LOG4CPLUS_FATAL(log1,"fatal message"); > } > Is this just an example or does the real code also return from the main() function while the ConfigureAndWatchThread is still running? If the real code looks like this example then the problem is in the code: The application might seem to be hung because even though the main thread has returned from main(), the ConfigureAndWatchThread is still running. Also, after you return from main() all static variables get destroyed. log4cplus uses them for various singletons. Accessing them in the ConfigureAndWatchThread after that is undefined behaviour. - -- VH -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iFYEAREIAAYFAkolPq0ACgkQhQBMvHf/WHndYgDdFageJ65NGnECam2j5yPC7kox B8LTZ/3+mKA0VQDfYaqYXiuwX46jhl3Oyb3sdjp9JXebOrQGZYtFpQ== =DwMh -----END PGP SIGNATURE----- |