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 Samuel Cheung <SC...@Novarra.com> on 2002/11/07 21:24:47 UTC

log4j SocketAppender questions

Hi,

Is SocketAppender in log4j thread safe? If I have multiple threads log to
the same SocketAppender, do I need to synchronize that the log method? 

And does SocketAppender have any internal buffer? Will every log() call
result in a network transmission? Or SocketAppender will buffer all the logs
until it reaches certain limit before it sends out the log thru the network
transmission.

Thank you for any information.
Sam

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: log4j SocketAppender questions

Posted by Ricardo Moral <ri...@yahoo.com>.
No, there is no need to synchronize the log method
before calling any logger that uses this appender.

This is because this appender extends the
AppenderSkeleton class. The AppenderSkeleton class is
the base class for many of the Appenders (Console,
JDBC, etc) and implements the
<code>doAppend(LoggingEvent)</code> method wich is the
method called by the Logger to report LoggingEvents.
This method is synchronized and calls the
<code>append(LoggingEvent)</code> that is an abstract
method that must be implemented in subclases... 



--- Samuel Cheung <SC...@Novarra.com> wrote:
> Hi,
> 
> Is SocketAppender in log4j thread safe? If I have
> multiple threads log to
> the same SocketAppender, do I need to synchronize
> that the log method? 
> 
> And does SocketAppender have any internal buffer?
> Will every log() call
> result in a network transmission? Or SocketAppender
> will buffer all the logs
> until it reaches certain limit before it sends out
> the log thru the network
> transmission.
> 
> Thank you for any information.
> Sam
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>