nant logs with data and time stamp
Asked Answered
D

2

7

How to run NAnt scripts in command line and get the timings of each task on the log file?

using nant <record> task or 
NAnt -buildfile:testscript.build testnanttarget

This produces console output but I can't see any timing information.

All I want each log message prefixed with datatime.

Dockage answered 30/11, 2008 at 13:30 Comment(0)
K
9

You can use the tstamp task to display the current date/time. Just include it everywhere where you want timing information. It will not prefix each line with a timestamp, but at least you can time some strategic points.

<tstamp />
Kerby answered 30/11, 2008 at 18:29 Comment(0)
B
5

Here is a sample of tstamp

    <echo>
    -----------------------------------------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------------------------------------
    TASK : INITIALIZE
    -----------------------------------------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------------------------------------
    </echo>

    <loadtasks assembly="nantcontrib-0.85/bin/NAnt.Contrib.Tasks.dll" />     
    <!-- http://www.basilv.com/psd/blog/2007/how-to-add-logging-to-ant-builds -->
    <tstamp>            
        <formatter property="timestamp" pattern="yyMMdd_HHmm"/>
    </tstamp>   

    <property name="build.log.filename" value="build_${timestamp}.log"/>

    <echo message="build.log.filename: ${build.log.filename}" />

    <record name="${build.log.dir}/${build.log.filename}"   action="Start" level="Verbose"/>        

    <echo message="Build logged to ${build.log.filename}"/>

    <echo message="Build Start at: ${datetime::now()}" />

</target>
Bield answered 6/7, 2012 at 15:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.