Alan,

One thing we have done is to use JMS. That may be overkill for you or you
simply want to do everything in memory. Before we used JMS I just wrote a
simple FIFO queue using wait() and notify() for logging. Threads enqueueing
a message would block with wait() until the queue dropped below the max and
then notify when complete. Dequeueing would wait() until a message is added
to queue and notify() once a message was dequeued. Then a single thread
could be used to do all of the dequeueing whereas multiple threads could
enqueue. This also enabled us to buffer dequeue operations. This worked
quite nicely until we moved to something a little more persistent like JMS.
I thought about trying to find someway to contribute this back to the group
but I could not quite figure out how to do it and I did not know what worth
it would have.

John


> 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