[Log4cplus-devel] RollingFileAppender in Multi threading based application
Logging Framework for C++
Brought to you by:
wilx
From: qwerty m. <qwe...@gm...> - 2013-11-20 11:34:52
|
Team, I am new to this mailing list. I don't have any prior knowledge on log4j as well. I want to use this log4cplus in our multi threading based larger application. I have some questions for implementing RollingFileAppender in multi threading application. Ours is a small backup application written in C++ having both client and server side components. Multiple clients can connect to the server simultaneously and send their backup data. I want to add logs for debugging in server side. This is my idea. I will have separate log file for each backup processing in the server side assuming backup name is unique here. Three threads will be involved in the server side for processing every backup received from the client side. Can I share the Logger object between the threads processing single backup in the server side ?. I had planned to achieve this by using a static map having backup name as key and Logger object as value here. And then from each thread, I will get this logger object from the map and then call the logging macros as below, LOG4CPLUS_XX(LoggerObj, LogMessage); # This happens with the same logger object from multiple threads. Do I have to use any mutex if I share the same logger object between different threads processing same backup ?. I have read from some forums that RollingFileAppender does synchronous write operations. Please confirm the same. If you could also point me some examples for my case, it will be very helpful. Thanks in advance, Prabu |