You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Peter Mutsaers <pe...@mutsaers.com> on 2001/08/28 16:15:30 UTC

Category.close() calls Appender.close() even if more Categories use the same appender

Hello,

I created a custom Appender that needs to be closed in order to commit
and close db connection.

Now I attached this appender to two categories. I expected that
Appender.close() would be caled only after I have called close() on
the *last* Category that uses this Appender.

However I noticed that it closes the Appender already when I close the
*first* Category, making the second Category still existant but unable
to write to log.

Is this intended behaviour or a bug?

TIA,

-- 
Peter Mutsaers  |  Dübendorf    | UNIX - Live free or die
plm@gmx.li      |  Switzerland  | Sent via FreeBSD 4.3-stable

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Logging in a Multi threaded environment

Posted by Ganapathi Raman <ma...@yahoo.com>.
Hi all...

Currently we are considering log4j for our application logger and so I have tried out the basic features of log4j ....

But i have a doubt when i try to log in a multithreaded environment...DOES log4j PROVIDE A SYNCHRONIZED LOGGING MECHANISM?? 

say a thread A is logging some message in a class at the same time when another thread of the same class is also busy logging!! In such an event my HO is that since the Category object that they share is a static one with the same name, messages from both the threads would go to the same Category object..am i right?

Also, consider a situation wherein my thread A has a big message and has called its cat.info(message)...similarly thread B had called its cat.info(message) but has only a smaller message. In such a case, which will appear first, say in my file if i use a FileAppender, message of thread A or B???

Can anyone please help me out??

Expecting an early response,

Regards,

Ganapathi.



---------------------------------
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger.