Question
Can anyone suggest to me the best way to capture the output from an Ant command?
I'm writing some routing tests for sun spot devices. The command itself returns network statistics. I'm trying to write something which will dump all these results into a more visual application.
I'm on Windows Vista.
Solution
you could simply use the ant recorder task:
<record name="build.log"> </record>
this has the advantage of having the output written both to the screen and to the log file, which isn't the case when doing output redirection ant debug > build.log
or calling ant with the -logfile
option.
OTHER TIPS
Use -logfile <file>
option to write the output to a file. Like @jespere said, you can get even more control by implementing your own logger or listener.
Simply use the "-verbose" flag and designate a file for the command line output using ">"?
For example:
ant -verbose > output.txt
You can define a custom Ant logger which will receive all Ant output. With that you can do whatever you want with the output.