OK, so this is probably more of an ant-dev question, but wouldn't it be better if:
1. An abstract BuildLoggerImpl (implements BuildLogger) stores the reference to 'out' and 'err' (isn't it poor encapsulation for Main to hold these anyway?). 2. Main passes in the name of the log file (if specified at the command line) to the logger in Main.createLogger() and it is BuildLoggerImpl that creates and sets the output stream from it. This still wouldn't let you specify the log name in the build file but it would allow a subclass of BuildLoggerImpl to override the normal creation process and instantiate an output stream in any way it wanted, which would be just as useful. The code is currently confusing because DefaultLogger and Main both store references to output streams, yet overriding the references in DefaultLogger (e.g. by overriding buildStarted()) is not sufficient to redirect all output elsewhere (why?). I'm sure someone who knows the source better than me can think of a way of further improving this to let the filename be specified in the buildfile. Phil. -----Original Message----- From: Glenn McAllister [mailto:[EMAIL PROTECTED] Sent: 19 February 2001 15:57 To: [email protected] Subject: Re: Logging to a file [EMAIL PROTECTED] wrote: > 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. In UN*X land, you can do the following: ant -logfile `date +%b_%d_%Y_%k%m%S`.log which on my box gives me an output file named Feb_19_2001_100235.log. I don't know if there is an equivalent command in Windows, as I can't reboot my box right now. I'm doing a 600+M download that I *really* don't want to interupt. :-) Glenn McAllister ---------------------------------------------------------------------- If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender. ----------------------------------------------------------------------
