I have a really curious problem using the Logging API. My code is the following :
- - - - - - - - - -
LoggerFactory factory;
Channel* file = factory.createChannel("FileChannel");
file->setProperty(FileChannel::PROP_PATH, "C:\tmp\appli.log");
file->setProperty(FileChannel::PROP_ROTATION, ":20");
file->setProperty(FileChannel::PROP_PURGEAGE, "10 minutes");
file->setProperty(PatternFormatter::PROP_TIMES, "local");
Channel* asyncFile = factory.createChannel("AsyncChannel");
dynamic_cast
Logger::create("simple", asyncFile);
// somewhere else
Thread t;
t.start(Empty()); // Empty is a Runnable doing nothing
- - - - - - - -
That works fine in a single threaded environment. But when I try to create another thread, even if this thread doesn't access the logger, or worse, does nothing, the application crashes with the Windows code 3 ("The system cannot find the path specified."). If I suppress the line "t.start(Empty());", that works fine.
The problem seems to appear only with the AsyncChannel. I think it is a determinitic behavior, as I can reproduce it as much as I want (and it allways occurs).
A subsidiary question : can I log to an AsyncChannel from several threads without explicit synchronization ?
Thanks very much.
--
I really like Poco !





