ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: Getting Ant to print the arguments of System.out.print() calls
Date Tue, 08 Jan 2008 14:44:36 GMT
> On Jan 8, 2008 5:54 AM, John Hendrie <john.hendrie@gmail.com> wrote:
> > public class Main {
> >     public static void main(String[] args) {
> >         System.out.print("Hello"); [...]
> >     }
> > }
> >
> > Ant doesn't output "Hello", I have to exit the Java app for 
> it to appear.
> > Any ideas on how I can solve this?
> 
> In Ant, the default System.out stream is replaced by an Ant-controlled
> stream to be able to capture output from all code run within Ant, and
> prefix the task name for example. Conor as a good write up on this
> somewhere, but basically Ant's logging system buffers all output by
> line, and since you use print instead of println, there's no carriage
> return that would flush Ant's buffer. The flush on System.out in your
> code has no effect. You can test this by issuing a println instead.
> 
> I don't think there's a way around this without some tricky coding,
> although it could also be that no one thought this was worth the dev
> effort and possible struggle to get it accepted to "un-line-buffer"
> the logging sub-system... --DD


Good catch, Dominique.


Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message