Bugs item #877974, was opened at 2004-01-15 18:57
Message generated for change (Comment added) made by mhandwerker
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=877974&group_id=22866

Category: JBossServer
Group: v3.2
>Status: Open
Resolution: Later
Priority: 5
Submitted By: Martin Handwerker (mhandwerker)
Assigned to: Scott M Stark (starksm)
Summary: Infinite recursion when using AsyncAppender and LoggerStream

Initial Comment:
On Jboss3.2.3, this code in 
org\jboss\logging\util\LoggerStream.java loops infinitely 
if the console logger is using an AsyncAppender:

         recursiveCheck.set(Boolean.TRUE);
         if (TRACE)
         {
            logger.log(level, msg, new Throwable());
         }
         else
         {
            logger.log(level, msg); // BUG if logger is Async!!
         }
         recursiveCheck.set(Boolean.FALSE);


--Martin Handwerker
Celequest Corporation
Work: (650) 637-2168

----------------------------------------------------------------------

>Comment By: Martin Handwerker (mhandwerker)
Date: 2004-02-09 13:09

Message:
Logged In: YES 
user_id=952324

Reproducing this problem requires an EAR which modifies the 
log4j appenders programatically, and shares a classloader with 
jboss log4j (the default setting).  It is not possible to 
reproduce with just a log4j.xml.

When log4j.xml is loaded or modified, jboss calls 
[org.jboss.logging.Log4jService.installSystemAdapters()] 
which replaces System.out with a LoggerStream wrapper.  It 
correctly does this AFTER any 
[org.apache.log4j.ConsoleAppender] have been instantiated, 
and are using the original System.out stream.

If an EAR file then creates a ConsoleAppender and adds it to 
an AsyncAppender, which it adds to the root category, that 
newly created ConsoleAppender will use the LoggerStream 
replacement of System.out.

If bytes are then written to System.out, the Logger Stream 
will trap them, and log them to the [STDOUT] logger.  The 
STDOUT logger will write to the AsyncAppender created by 
the EAR file, which will write from a different thread to the 
ConsoleAppender created by the EAR file, which will in turn go 
back to the jboss LoggerStream, as it will be using a jboss-
modified System.out.  This creates an infinite loop.

The problem doesn't happen when an AsyncAppender uses a 
ConsoleAppender created in log4j.xml, because jboss is 
careful to call Log4jService.installSystemAdapters() only after 
ConsoleAppenders have been created using the original 
System.out.

There might not be a solution for this problem, other than to 
document that the 
org.jboss.logging.Log4jService.catchSystemOut 
and ...catchSystemErr system properties can be set to false 
to work around the problem if it occurs.

----------------------------------------------------------------------

Comment By: Scott M Stark (starksm)
Date: 2004-02-08 15:46

Message:
Logged In: YES 
user_id=175228

Please attach the log4j.xml config that sets up this scenario.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=877974&group_id=22866


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to