|
From: Bastiaan B. <Bas...@li...> - 2003-03-03 12:15:28
|
On Mon, 2003-03-03 at 09:09, Amit V Garde wrote: > I'm planning to use log4cpp 0.3.4b in a multithreaded setting (on Solaris with > g++ 3.x and on Win 2K server with MS VC++ 6.0) and I had the following > questions regarding thread safety and the relationship between Categories and > Appenders. > > Is doing the following thread safe by default or does explicit synchronization > need to be provided by the code using log4cpp ? > > 1. Multiple threads logging using the same Category object > Is thread safe, even if threading support is not enabled. Note that in that case on Win32 systems, log messages may become intertwined. > 2. Multiple FileAppenders or RollingFileAppenders writing to the same > underlying file (possibly from different threads) ? This may lead to intertwined log messages if file writes on your OS aren't atomic. In most cases you can avoid this, by sharing the FileAppender, rather than the underlying file. > > If I need to provide synchronization, are there any guidelines regarding > what to lock and where etc for minimizing the performance hit ? > > Also, is it okay/advisable to set the same Appender for multiple Category > objects (again in a multithreaded setting) ? Using the same Appender for multiple Categories is OK. If it doesn't work, that definitively is consider a bug. > > Apologies if this is not the right place to ask usage related questions. Could > someone point me somewhere that is appropriate if thuis is so ? Well, officially this is the 'development' mailing list. But since the traffic is so low and there isn't a 'users' mailing list, I don't mind, and I assume the other list members don't mind either. Bastiaan > > Thanks for any advice... > > Amit > ------------------------------------------------------------------------------- > | Amit V. Garde | am...@pe... | +91-20-567-8900 x517 | > | Persistent Systems | Bhageerath,402 Senapati Bapat Road,Pune 411 016, India | > ------------------------------------------------------------------------------- > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Log4cpp-devel mailing list > Log...@li... > https://lists.sourceforge.net/lists/listinfo/log4cpp-devel |