开发者

Getting ant to log to file as well as screen/terminal

开发者 https://www.devze.com 2022-12-26 15:26 出处:网络
I\'ve searched these forums as well as the internet and could not find a clear answer. I\'m executing an ant task. I would like the output to get put 开发者_JAVA技巧to the screen as well as a log file

I've searched these forums as well as the internet and could not find a clear answer. I'm executing an ant task. I would like the output to get put 开发者_JAVA技巧to the screen as well as a log file ... how can I do this?


You should use the ant task <record>. See http://ant.apache.org/manual/Tasks/recorder.html.

In your ant file do something like:

...
<record name="logfile.txt" action="start" append="false" />
...
your ant code...
...
<record name="logfile.txt" action="stop"/>

The output from ant between the two record statements will be written to 'logfile.txt'


If you are on Unix, you can use the tee command. If you are on Windows, you can use PowerShell to accomplish the same thing, you would just need to run PowerShell at the command prompt and then execute your ant command.

ant | tee "output.log"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号