ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Logging to a file
Date Mon, 19 Feb 2001 15:45:33 GMT
Phillip Wells <Phillip.Wells@dresdnerkb.com> wrote:

> 2. I can't use the XmlLogger because although you can specify the
> logfile using a property task in your buildfile, I just want
> System.out, not an XML file.  

> 3. I can't write a listener to do this myself because the listener
> doesn't have access to the 'out' and 'err' attributes of
> org.apache.tools.ant.Main which is where the logging output streams
> are held.

If you really want to access out and err, XmlLogger wouldn't be the
right thing to use anyway - it simply ignores whatever is send
there. It doesn't even get a chance to handle that.

If - on the other hand - XmlLogger would be fine but the XML is too
much for you, it should be quite simple to write a Listener that
writes all events to a file whose name has been generated from
properties, just like XmlLogger does.

> In a nutshell: I want to be able to specify a file to log to in the
> buildfile and have System.out and System.err automatically
> redirected there.

And whose name has been generated from some properties. Without this
additional constraint, -logfile would be the solution. With this
constraint the answer is you can't. The main problem is that some
events will be generated before any properties have been set.

Stefan

Mime
View raw message