You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2003/01/15 12:51:35 UTC

DO NOT REPLY [Bug 16105] New: - AsyncAppender with null message

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16105>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16105

AsyncAppender with null message

           Summary: AsyncAppender with null message
           Product: Log4j
           Version: 1.2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Appender
        AssignedTo: log4j-dev@jakarta.apache.org
        ReportedBy: ceki@apache.org


Subject: RE: AsyncAppender Waiting for BoundedFIFO to Empty
To: <lo...@jakarta.apache.org>
Cc: "development" <de...@afterbot.com> 


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: 'log4j-dev@jakarta.apache.org'
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

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