View Single Post
  #2 (permalink)  
Old August 3rd, 2011, 10:58 AM
planoie's Avatar
planoie planoie is offline
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

You should use the <record> nant task instead. The logfile command line argument simply redirects the command line output to a log file. The record task lets you control what and how the build output is recorded. You can specify the file name using standard nant property syntax so it's variable. Usually, you'd start recording very early on outside of any targets so that it starts regardless of the called target. Then you use the built in "nant.onsuccess" and/or "nant.onfailure" properties to specify targets to run in each case. Use these targets to close the recording. I have a separate target to "finalize" the build log to minimize repetition.

Here are the relevant bits from a build file I use...

<project ... >

	<record name="${path.buildLog.file}" action="Start" />

	<property name="nant.onsuccess" value="onSuccess"/>
	<property name="nant.onfailure" value="onFailure" />

	<!-- other targets -->

	<target name="onSuccess">
		<echo message="Build Succeeded." />
		<call target="finalize" />

	<target name="onFailure">
		<echo message="Build Failed." />
		<call target="finalize" />

	<target name="finalize">
		<!-- other cleanup stuff here -->
		<record name="${path.buildLog.file}" action="Close" />

Reply With Quote
The Following User Says Thank You to planoie For This Useful Post:
raju.sathliya (November 16th, 2011)