prolink007
prolink007

Reputation: 34564

displaying ant task/target in recorder log

I am using the ant task <record> to create a log file of the output and activity of my ant build script. The problem is:

i am not seeing the names of the targets that are being executed.

For instance: When my target called cleanFW is being executed, i only see the stuff being done inside the target and NOT the name of the target it self. Since this is happening, i have no way of telling when cleanFW began in the log file.

Is there a way to get this cleanFW target name to appear? It was appearing when i was using the flag -logfile. But i had to switch to <record> because i want to record log file and see the output in console.

Using Ant 1.8.2


simple solution

My simple solution to this is to just put an echo in each one of the targets. Just wondering if there was a better way.


sample code where it is not working

<project name="foobar">

<record name="test.txt" action="start" append="true" loglevel="verbose" />

... lots of property stuff here ...

    <target name="cleanFW">
        <record name="test.txtaction="start" append="true" loglevel="verbose"/>
        <mkdir dir="${FOOBAR_OUTPUT}"/>
        <mkdir dir="${FOOBAR_GEN}"/>
        <delete includeemptydirs="true"> 
            <fileset dir="${FOOBAR_BIN}" includes="**/*"/>
            <fileset dir="${FOOBAR_GENERATED}" includes="**/*"/>
            <fileset dir="${FOOBAR_NODES}" includes="**/*"/>
            <fileset dir="${FOOBAR_GEN}" includes="**/*"/>
        </delete>
        <mkdir dir="${FOOBAR_OUTPUT}"/>
        <record name="test.txt" action="stop"/>
    </target>

<record name="test.txt" action="stop"/>   

</project>

The reason why i have the first record name="test.txt" action="start" append="true" loglevel="verbose" /> at the top, is because i want all of the statements and stuff that are before the targets to be displayed too. Like my property sets and all that jazz. I left that junk out because it is not important.

Upvotes: 1

Views: 3357

Answers (1)

martin clayton
martin clayton

Reputation: 78165

I'm at a bit of a loss to explain why exactly, but I think you need to omit the last record 'stop' task - the one that is outside of a target.

Having said that, you can probably omit all of the record tasks except the first 'start', and get the result you want.

Upvotes: 2

Related Questions