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? (Was: RE: [submi t] I ntegration of Ant into Visual Age for Java)
Date Tue, 21 Nov 2000 12:17:13 GMT
> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@apache.org]
>
> It would probably be cleaner to have two separate tasks, one for
> writing text - maybe redirecting it to a file - and one for writing
> log messages. I'm just not sure, which of both would deserve the name
> echo.
>
> If we keep them as one task (which might be easiest for new users, I'm
> not sure) maybe we should say you can either specify outfile or
> loglevel, but not both of them? If you don't specify outfile we use
> the logging system, if you do we'll write to the file.
>

Personally, I think we should have two different tasks, but perhaps
diced a little differently. Rather than having one task for writing text
and one for logging, I would have one task for writing to files and one
for logging. IMHO, the only place to "write text", if you are not
writing to a file, is to the log. In the general situation, we cannot
assume that we can write text to System.out. It won't make sense in the
GUI situation.

So, I support a <log> task with a log level attribute and no file
"output" attribute. You are writing to the log and it is up to the
logger where that output gets written. I prefer the name <log> over
<echo> as it is clearer what is being done by the task. The second task
is JUST for writing to files. I'd probably call it something verbose
like <filewrite> to be explicit what it does. I like being explicit :-).
It has a mandatory "output" (or "file") attribute, an "append"
attribute, and NO "log level" attribute.

As for the <echo> task, I'd deprecate it. If it is not writing to a
file, I would make it log with MSG_INFO. It would not have a log level
attribute.

We are also going to need to handle the case of java classes, executed
by ant in-VM, which write to System.out. This output should be directed
to the log with MSG_INFO for System.out and MSG_WARN for System.err. We
will probably need a LogOutputStream for this. This is similar to the
LogStreamHandler for java classes run in a separate VM.

Conor


Mime
View raw message