ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claudio Corsi <>
Subject Re: altering logger by target
Date Thu, 07 Aug 2003 15:33:28 GMT

I have a suggestion that might help.

Implement your own version of the Logger, for examples extend the 

Overide the targetStart and targetFinished method.

You then check for the the test.unit target.

At that point, you can update the OutputPrintStream and ErrorPrintStream 
with your own that will be able to print the output more cleanly. I 
would consider the PrintStream to redirect the output to the original 

When you are then exiting the target, you can replace your 
OutputPrintStream and ErrorPrintStream with the original ones.

Note, I have not tested this but it seems logical enough to work.


David McTavish wrote:
> Is it possible to change the logger being used (Ant 1.5.3) on a per-target
> basis? I'm thinking 'no', but am hoping for creative ideas...
> Overview of the problem is as follows:
> - user invokes target A which compiles and deploys our product. (I wish to
> use default logger here)
> - target A invokes target "test.unit" which runs our junit test suite (I
> wish to use a different logger to format the junit output a little more
> cleanly)
> - target A invokes some other processes which should use the default logger
> again
> Any ideas are more than appreciated!
> thx,
> d.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message