That is useful to know - thanks!

-----Original Message-----
From: Curt Arnold [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 07, 2005 12:56 PM
To: Log4J Users List
Subject: Re: multi-threading and log4j - bottleneck?


On Feb 7, 2005, at 12:12 PM, Anil Philip wrote:

> Thanks for your reply.
> Assuming the calls are enabled, then will not there be a synchronizing
> bottleneck introduced?
> The threads were supposed to synchronize among themselves as part of 
> their
> application logic.
> But now they are synchronizing because of logging.
> Thanks,


Actually logging a message to appender will eventually require access 
to some shared resource and hence will require a synchronization lock 
of some sort.  It is a performance improvement goal to reduce the cost 
of synchronization.  It can be minimized but not avoided.

You may want to investigate the AsyncAppender.  For example, if you are 
using a FileAppender, that appender will block other thread from 
writing to the same appender for the duration of the file write.  If 
you wrap the FileAppender with an AsyncAppender, other threads are only 
blocked for the time necessary to insert the request into a queue.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to