Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nant logs with data and time stamp

Tags:

nant

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.

like image 636
sundar venugopal Avatar asked Nov 30 '08 13:11

sundar venugopal


2 Answers

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 />
like image 91
wimh Avatar answered Nov 23 '22 16:11

wimh


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>
like image 22
aked Avatar answered Nov 23 '22 16:11

aked