logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Skeet" <jon.sk...@peramon.com>
Subject RE: Logging in a Multi threaded environment
Date Thu, 06 Sep 2001 13:00:57 GMT
> 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 

Yes - or rather, it depends on the appender in question, but any
appender inheriting from AppenderSkeleton (which most will) synchronize

> 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???

Whichever gets to the appender.doAppend() first.


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

View raw message