ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <>
Subject Re: Integrating own BuildLogger
Date Thu, 02 Sep 2004 07:53:48 GMT
Robert Virkus wrote:
> Hi everyone,
> I am trying to substitute the original build logger in my task with Ant 1.6.1. 
> I have written a wrapper-class which just forwards the events to the original 
> build logger, which works fine as long as I don't try to modify the build 
> events. When I change a build event, however, Ant is stopping the execution 
> with the message "BUILD FAILED
> Listener attempted to access System.out - infinite loop terminated"

This is an interesting problem. Nothing you're doing sounds like a 
problem but somewhere something in your message handling is attempting 
to output a message. i.e. before one message has been delivered to the 
listeners something is attempting to send another. The message above 
gives the most common cause but it is in fact not the only possibility 
as I found when trying to sort out your problem.

Since your logger is loaded by an AntClassLoader it is susceptible to 
any logging done by that classloader. In fact I reproduced your problem 
and here is the stack trace

Listener attempted to access System.out - infinite loop terminated
         at java.lang.ClassLoader.loadClass(
         at java.lang.ClassLoader.loadClassInternal(
         at PolishLogger.messageLogged(

So the deferred classloading that is triggered in your messageLogged 
method causes the AntClassLoader to log a message (a class being loaded).

The workaround is to trigger the class loading earlier. I changed the 
PolishLogger constructor as follows:

     public PolishLogger(BuildLogger realLogger, Project project)
         this.logger = realLogger;
         BuildEvent event = new BuildEvent(project);
         String s = new String();
         StringBuffer sb = new StringBuffer();

Note that it is not easy to ensure you have got all the classes loaded. 
A better solution might be to not load the PolishLogger through the 


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message