Well Marc, you hit a bulleye. I also experienced the same problem with my
log client implementation and observed everything that you observed. In our
implementation, we were redirecting all received events on the client to the
JTextPane component and a file; we had two appenders set up on the
SocketServer, such as FileAppender and TextPaneAppender. Initially, when the
load on the log client was small, everything was great but then when we
performed some stress testing and we started to generate event messages 1
every second we noticed that after 10-15 minutes our client would block and
then our server would block, practicaly bringing everything to a stand
still. Thinking alone the same lines as you did, I started to use
AsyncAppender, but the problem did not go away. So, I started testing the
client for problems, such as the fileAppender and the TextPaneAppender. What
I discovered was that when I would turn off logging using
TextPaneAppender(no messages were send to GUI) everything would work fine
just with a single FileAppender working. On the other hand, if I would turn
the logging on to the JTextPane or just TextPane using TextPaneAppender, the
log client would block. What happens is that JTextArea or TextArea component
of swing or awt can't handle all the message that are being generated for
them, luck of buffer size or something else, and block, therefore forcing
everything else to block. What you need to do, I did not get a chance to do
it myself yet is to create a separate thread for handling all received log
events which would first log all events to a growable queue and then
redirect them from the queue to your GUI component. I think this should
work, but AsyncAppender will definitely not help you, because the size of
the buffer it has is very small and not configurable and not dynamically
growable. Well, that's all I have. May be this will help you. I tried to
write to Ceki about this but I got no response back. Goodluck. What GUI
component are you using?

Max Stolyarov

-----Original Message-----
From: Marc Carrion [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 17, 2002 6:06 AM
To: [EMAIL PROTECTED]
Subject: RE: problems using SocketAppender and AsyncAppender



  Any help on that?

  Thanks,
         Marc

---- Original Message ----
De: [EMAIL PROTECTED]
Para: [EMAIL PROTECTED], 
Asunto: RE: problems using SocketAppender and AsyncAppender
Fecha: Tue, 15 Jan 2002 11:23:57 +0100

>  Hello, we are using log4j in our application (configuring some
>socket appenders) and recently we had problems when one of the
>clients(chainsaw, logfactor5, ...) listening for logs hangs, the
>application blocks waiting for I/O. 
>
>  We found that the problem occurs because the client is blocked for
>I/O and then the socket blocks too, and due to, the main thread too.
>
>  Finally we decided to use the AsyncAppender, it should work
>asynchronous, it would use another thread to write so the main thread
>will never become blocked. But, if one of the SocketAppenders
>referenced in the AsyncAppender hangs, then it never write and the
>queue of events become full, so, the AsyncAppender blocks, and
>consecuently the main thread blocks waiting for I/O.
>
>  So, the AsyncAppender doesn't works asynchronous, it waits actively
>until the queue has more space.
>
>  Do anybody had the same problem? How did you solve it? Is it a
>known bug? Will it be solved?
>
>  Thanks,
>         Fernando & Marc
>
>
>--
>To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to