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 Ganapathi Raman <ma...@yahoo.com> on 2001/09/06 14:54:23 UTC

Logging in a Multi threaded environment

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.