开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜