Hello Ceki,
I have not had the time to check your suggested code modification, but it makes sense to avoid these infinite loops.
What do other ant committers think ?
(I have moved the discussion to [EMAIL PROTECTED], I think this is more appropriate).
Antoine
Ceki Gülcü wrote:
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,
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]