Quantcast
Channel: Eureka! » Ant
Viewing all articles
Browse latest Browse all 26

Apache Ant – Capture Ant output log using recorder task

$
0
0

There is a <record> task in Ant so you could save the Ant output during the Ant Build. Here is an example.

1. build.xml

<project name="ant-recorder-example" default="record" basedir=".">
  <target name="record">
    <record name="${basedir}/build.log" action="start" append="yes"/>
      <!--
        Whatever ant tasks being executed here,
        the output would be recorded by the recorder
      -->
      <echo message="Hello world"/>
      <echo message="All the above output will be recorded down in the build.log."/>
      <echo message="After the run, check the build.log."/>
    <record name="${basedir}/build.log" action="stop" append="yes"/>
  </target>
</project>

 

2. Run Ant
ant-recorder-example
 

3. Check the build.log
ant-recorder-example-2
 

Done =)

Reference: Ant – Recorder Task


Filed under: Ant Tagged: Ant

Viewing all articles
Browse latest Browse all 26

Trending Articles