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 Ceki Gülcü <ce...@qos.ch> on 2003/04/09 05:58:15 UTC

RE: AsyncAppender in log4j

Hi Ram,

You can attach multiple appenders of any type to an AsyncAppender. An
AsyncAppender can be attached to a logger like any other
appender. Whenever a logging event needs to be logged, the event is
handed to the AsyncAppender which buffers it and returns control to
the caller. A separate dispatcher thread inside the AsyncAppender will
process the events in the buffer by calling all the appenders attached
to the AsyncAppender. The event is then removed from the buffer.

This is also explained in the complete manual. I have included a
couple of pages as an attachment. I hope this helps,

At 03:34 PM 4/8/2003 +0530, Ramadoss Chinnakuzhandai wrote:
 > Hi Paul :)
 >            well that's interesting too...
 >
 > YES the first point you mentioned is correct..yeah I want appender to 
have an 'optional' asynchronous 'behaviour'.
 >
 > What sort of control to the asynchronosity(??)---->> My requirement is 
so simple as follows
 >
 > Logging of type 1: logging ====> log4j ===> FileAppender(Which writes 
into local File).
 >
 > Logging of type 2: logging ====> log4j ===>JMSAppender ===> JMS Queue 
===>JMS Adaptor ===> Helper Class which writes log data onto a File or DB.
 >
 > The above are the requirements.
 >
 > The important thing is that on either case(step 1 and step 2)control
 > should immediately return back to the process as soon as log4j
 > dispatches to FileAppender or JMSAppender. This is the reason why I
 > just wondering about AsyncAppender in which we can add any appenders
 > to it and the moment control go to AsyncAppender would immediately
 > return back as AsyncAppender is a different thread itself which
 > actually process log request and dispatch to FileAppender or
 > JMSAppender or whatever appender attached to it and that is the
 > process I feel the real asynchronous.
 >
 > Let me know your comments reg the same.
 >
 > Cheers :)
 > Ram

--
Ceki  For log4j documentation consider "The complete log4j manual"
       http://www.qos.ch/shop/products/clm_t.jsp