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 2002/08/01 11:20:27 UTC

Fwd: an AsyncAppender class

Paul,

If you omit the join operation, you have no way of knowing when the
appenders attached to the AsyncAppender have finished their work. If
thinking that the previous AsyncAppender was closed, you immediately
create another AsyncAppender that encapsulates appenders writing to
the same system resources (DB, file..) this may result in two sets of
appenders writing to the same file albeit for a short while. In the
case of databases this may result in out of order logs which is not a
big deal. However, in the case of files this may result in corrupt
files. It's a question of reliablity...

Hope this answers the question.

>Delivered-To: ceki@qos.ch
>X-Originating-IP: [139.149.1.195]
>From: "Paul Voutier" <pv...@hotmail.com>
>To: ceki@qos.ch
>Subject: an AsyncAppender class
>Date: Thu, 01 Aug 2002 08:57:28 +0000
>X-OriginalArrivalTime: 01 Aug 2002 08:57:29.0096 (UTC) 
>FILETIME=[76ED0880:01C23939]
>
>
>hi Ceki,
>
>I hope you don't mind me asking you another question.
>
>In the AsyncAppender.close() method, you call
>
>dispatcher.join();
>
>We are running this logging on Apache/JServ (I know that JServ is old, but 
>this is a production system so this is what we are stuck with) and 
>experiencing performance problems which we have tracked down to this statement.
>
>Basically, we are wondering why that dispatcher.join() line is needed.
>
>Can you explain why it is necessary, or good, to wait there until the 
>dispatcher has finished its work?
>
>Can we just comment out this line (along with the "bf = null" and 
>"dispatcher = null" lines that follow it -- as leaving those lines in 
>would be bad)?
>
>If you are interested, then the problem that we are experiencing is as 
>follows.
>
>Basically, we have a simple servlet in which we do some async logging, 
>then close the logger. As part of closing the logger, we call 
>AsyncAppender.close() which calls this. The servlet doesn't render until 
>this dispatcher.join() "succeeds". Which is taking about 200 ms with our 
>JDBCAppender attached to the AsyncAppender.
>
>Now when I comment out the dispatcher.join() line in AsyncAppender.close() 
>and also comment out the
>bf = null;
>and
>dispatcher = null;
>lines that follow, then the servlet renders in "no time" as opposed to 
>taking 200 ms.
>
>I would really appreciate any help that you can provide us.
>
>Paul

--
Ceki


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