Hi Alan you may want to take a look at the org.apache.log4j.AsyncAppender as
I think this does what you want.

The other detail is to see the bench marks done on this.  The overhead of
thread communication may be greater than doing the logging directly.  The
bench marks are part of the org.apache.log4j.performance.Logging java docs.


-Peace
Dave


> -----Original Message-----
> From: Alan Robertson [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 29, 2001 2:46 PM
> To: [EMAIL PROTECTED]
> Subject: Log4J in separate thread?
> 
> 
> Hi all,
> 
> I'm developing a logging API for use by my company and am hoping I can
> use Log4J to implement this API.  One of the requirements I 
> must satisfy
> is that the logging tool I develop must do its processing in 
> a separate
> thread from the code that calls it.
> 
> To do so, I'm thinking that I can extend the Category class and
> overwrite the forcedLog() method to create the LoggingEvent object and
> then add it to a Vector which is a class variable.  I would then also
> have this class implement Runnable and in the Run() method I 
> could have
> a loop which pulls LoggingEvent objects off the Vector and invokes the
> callAppenders() method on them.
> 
> Has anyone tried something similar and maybe have a better 
> solution for
> how to do this?  It occurs to me that having Log4J do most of its
> processing in a seperate thread might also improve its performace.
> Especially when you want to get location information on the 
> caller.  Is
> there a reason that Log4J does not do so?
> 
> Thanks,
> 
> Alan Robertson
> [EMAIL PROTECTED]
> InfoNow Corp.
> 
> 
> ---------------------------------------------------------------------
> 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