ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <co...@m64.com>
Subject RE: Why does the echo task output to System.out?
Date Wed, 22 Nov 2000 08:38:22 GMT
> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@apache.org]
>
> There already is a LogOutputStream class for exactly this type of
> thing.

Umm - should have looked :-)

> I had modified the java task to support output files shortly
> after the release, so it should be quite easy to plug in a
> LogOutputStream into it. Other tasks like <junit> may have different
> issues.
>
> One thing to note here (<java> task) is that we are going to face the
> same problem we had with <echo> in a slightly different way. This task
> has a outfile attribute to redirect the output - and obviously nobody
> ever thought of using the logging system in any other situation - so
> it's either write to the file or to Ant's logging system (to ensure it
> ends up somewhere where the user can read it).

Yes, the issue really applies to all Tasks and so, perhaps, the
mechanisms for redirection should be supplied in the Task superclass.
System.out/System.err would be set to either a logOutputStream or a
FileOutputStream and the particular task execution could ignore the
whole issue, just writing to System.out. When using the LogOuptutStream,
log levels would not be settable, just coming out as MSG_INFO for
System.out and MSG_WARN for System.err. Either that or we create a new
log level for task output, such as MSG_OUTPUT. A separate <log> task
with the ability to write a message at a particular level may still be
useful.

Whaddaya reckon?


Mime
View raw message