Another "advice" on consumer threads is to catch ALL Throwables in the main
loop, report it and continue like nothing happened.
Niclas
On Wednesday 15 January 2003 19:25, Matt Bates wrote:
> If anyone is interested, we have solved the problem. It appears that
> the dispatcher thread is dying in AsyncAppender class which causes the
> BoundedFIFO buffer to be filled with LoggingEvents and those events are
> never consumed. The interesting part is how the Dispatcher thread died.
> The thread will die if a null object is logged (for example, the
> getMessage() on a NullPointerException will return null) and the
> XMLLayout class is used. The Formatter object does not check for a null
> message and performs a length() on the message thus resulting in an
> exception and the death of the thread.
>
> To resolve the problem, we wrote our own XMLLayout class that will not
> allow a null to be passed to the Formatter class and everything appears
> to be working.
>
> -Matt
>
> -----Original Message-----
> From: Matt Bates
> Sent: Wednesday, January 08, 2003 6:50 PM
> To: '[EMAIL PROTECTED]'
> Subject: AsyncAppender Waiting for BoundedFIFO to Empty
>
>
> I am using log4j 1.2.4 and running into a problem where the append
> method in the AsyncAppender is in a wait state because the BoundedFIFO
> is full (see code snippet of AsyncAppender class below). Because of the
> synchronization, other log messages can not be added to the queue and
> they are in a wait state as well ... basically bringing the system
> (weblogic 6.1 SP4 on JDK 1.3.1) to a halt.
>
> Can anyone tell me why this is happening? It does not happen very
> frequent but when more load (i.e. more logs) is put on the system, it
> appears more often. Our config XML contains 3 appenders with one
> writing to a ConsoleAppender, one writing to the
> DailyRollingFileAppender, and one writing to the AsyncAppender. Is it
> as simple as increasing the BoundedFIFO size or is that just masking the
> problem.
>
> the method that is causing the block in AsyncAppender:
>
> void append(LoggingEvent event) {
> --- omitted ---
> synchronized(bf) {
> while(bf.isFull()) {
> try {
> //LogLog.debug("Waiting for free space in buffer, "+bf.length());
> bf.wait();
> } catch(InterruptedException e) {
> if(!interruptedWarningMessage) {
> interruptedWarningMessage = true;
> LogLog.warn("AsyncAppender interrupted.", e);
> } else {
> LogLog.warn("AsyncAppender interrupted again.");
> }
> }
>
> --- omitted ---
>
>
> Thank you for any comments/suggestions you may have
>
> Matthew Bates
> AfterBOT, Inc.
> 4351 Shackleford Road
> Norcross, GA 30093
>
> <http://www.afterbot.com/> http://www.AfterBOT.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>