prolink007
prolink007

Reputation: 34564

using logfile and displaying results and activity to console in ant

I am currently using the -logfile flag on my ant script. Is there a way to display the ant output to the console and have it log the output too?

I can not download other applications to acheive this. Needs to be native to windows or ant.

Thanks

Upvotes: 1

Views: 1720

Answers (2)

martin clayton
martin clayton

Reputation: 78175

Ant has a recorder task that can be used to log all or part of a build to a file.

To just record the whole build to a file add a line like:

<record name="build.log" />

near to the start of your buildfile. There are options to set the level of verbosity and control log file appending too.

You can run multiple recorders during a build - say to capture a summary to one log file, and full details to a longer second log file. You can also use the action attribute of the task to run the recording for just part of the build.

Upvotes: 1

barfuin
barfuin

Reputation: 17494

With "native to Windows", do you mean that it must run on Windows?

If so, you can use the tee command:

ant | tee logfile.txt

will show the output on the console and log it in logfile.txt at the same time.

tee is originally a unix command. On windows, you can get it as part of the free Unix Utils.

Upvotes: 0

Related Questions