Hello,
I m using QThread and Log4cxx in a project. I created a simple class
with static member to access logging anywhere in my soft.
But when I m accessing from another thread I have some kind of random crash.
I tested without multithread and it work fine.
It s written in Log4cxx Faq that it s Thread safe. Am I wrong to use
class static members or is there a bug in the thread safe
functionnality? Is it problem to use QT Qthread with log4cxx?
Thank you for any kind help.
Best regards.
here the class declaration, initialization, and log sample.
//my class
class Log{
public :
static log4cxx::logstream stream;
static log4cxx::LoggerPtr logger;
};
//initialization
log4cxx::LoggerPtr Log::logger(log4cxx::Logger::getLogger("Logger"));
log4cxx::logstream Log::stream(Log::logger, log4cxx::Level::DEBUG);
//logging sample
Log::stream<<"message"<<LOG4CXX_ENDMSG;