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

谁说胖子不能爱 提交于 2019-12-08 14:42:35

问题


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 to the screen as well as a log file ... how can I do this?


回答1:


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'




回答2:


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"


来源:https://stackoverflow.com/questions/2595538/getting-ant-to-log-to-file-as-well-as-screen-terminal

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!