Hello,
While running test cases for log4j, I have noticed that our latest version produces an infinite loop in Project.fireMessageLoggedEvent() since in our test version, org.apache.log4j.Logger.getLogger() generates output on the console, which triggers another call to fireMessageLoggedEvent, hence the infinite loop.
Would it be possible to modify Project.fireMessageLoggedEvent() so that it ignores recursive calls to fireMessageLogged() instead of throwing a BuildException? Here is the proposed change:
NOW:
synchronized (this) { if (loggingMessage) { throw new BuildException("Listener attempted to access " + (priority == MSG_ERR ? "System.err" : "System.out") + " with message [" + message + "] - infinite loop terminated"); }
try { loggingMessage = true; Iterator iter = listeners.iterator(); while (iter.hasNext()) { BuildListener listener = (BuildListener) iter.next(); listener.messageLogged(event); } } finally { loggingMessage = false; } }
PROPOSED CHANGE:
synchronized (this) { if (loggingMessage) { return; } ... the rest remains the same
If this change is unacceptable, would you consider adding infinite loop detection in Log4jListener.messageLogged(BuildEvent event)?
Many thanks in advance,
-- Ceki Gülcü
The complete log4j manual: http://www.qos.ch/log4j/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]