Ceki,
You say that "localization information must be extracted within the thread that 
invoked the logging operation".  If I'm not mistaken, this is partly true.  To extract 
the location information a Throwable object is created and the stack trace from that 
object is parsed for class name, file name, method name, and line number.  Now the 
creation of the Throwable object is the only part that _really_ needs to be done in 
the same thread
that invoked the logging operation, right?  The parsing of the stack trace can be done 
in a seperate thread I believe.
So, have you done any testing to determine which part of the above operation takes the 
most time?  Is it the creation of the Throwable object or the parsing of the stack 
trace that makes getting location information so slow?  I'll try to do some testing of 
my own to anwer that question, but any insight you have would be greatly appreciated.
Thanks to you and Dave for the quick reply about AsynchAppender, that class will be 
very handy (regardless of location information issues).

Ceki Gülcü wrote:

> Alan,
>
> As has been suggested by Dave King have a look at the AsyncAppender. One very 
>important point to note is that localization information must be extracted within the 
>thread that invoked the logging operation. Since the extraction of localization 
>information is comparatively very slow (20 times slower), off loading work to a 
>helper thread will not help. It won't hurt either as everything will be dwarfed by 
>localization extraction.
>
> One could change the way localization information is extracted in AsyncAppender, so 
>that most of the work would be performed in the helper thread. Cheers, Ceki
>
> At 14:46 29.03.2001 -0700, you wrote:
> >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.
>
> --
> Ceki Gülcü          Web: http://qos.ch
>                 email: [EMAIL PROTECTED] (preferred)
>                          [EMAIL PROTECTED]
>
> I hope to see you at my ApacheCon 2001 presentation
> entitled "Log4j, A Logging Package for Java".
>
> See http://ApacheCon.Com/2001/US/ for more details.
>
> ---------------------------------------------------------------------
> 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