Suppressing Log Output for NAnt Delete Task
Asked Answered
R

1

9

We are currently using CruiseControl.NET with NAnt 0.85 build scripts and while everything is working well, the log files are a little too verbose for my liking.

In particular, when deleting folders using the <delete> task I always get a [delete] Deleting directory entry in the log.

Fair enough but this task is run in a foreach loop and results in a long list of entries (especially if the folders contained files - each deletion is reported) which is just cluttering the log and making it difficulty to read without endless scrolling. I've added numerous <echo> tasks to report the scripts progress so don't really need all this 'fluff'.

I've used the verbose="false" attribute on the <delete> task and while this supressed the file deletion messages (which improved the log readability no end) the folder deletions are still reported. I've tried utilising the verbose attribute on the foreach but this made no difference.

Does anyone know how I can supress these messages or am I stuck with them .. ?

Rodriques answered 7/10, 2009 at 13:6 Comment(2)
I'm interested in the answer as well. BTW: verbose="false" neither makes <copy> or <mkdir> shut up.Jacquerie
I think the verbose eliminates most of the messages but not those at 'the top of the tree' as it were. So while I don't see every file copy it do get the following: '[copy] Copying 1436 files to 'C:\inetpub\wwwroot\<appName>'.Rodriques
E
10

I've looked into this before and it comes down to the internals of NAnt and the way the project's logging threshold cannot be properly controlled (arguably a bug). There has been good conversation around a non-intrusive workaround which is to create and consume a new task called LogLevel.

A use case would be the following:

<loglevel level="None">
    <delete file="helloworld.txt"/>
</loglevel>

The first post discussing this was from Shh, Keep it Quiet, by Jay Flowers. There was then a nice follow up to this post by Rory Primrose. Be sure to check the comments as there is very useful information revealed.

Ensnare answered 15/10, 2009 at 21:6 Comment(4)
Bah - Day off today, I'll have to check on Monday. Cheers ScottRodriques
Sorted! I tried the link from Jay Flowers but that didn't work for me. Rorys post however sorted it out and I can now, finally, purge my logs of all this 'fluff'. CheersRodriques
follow up link not working anymore, but answer still very usefulStraphanger
The followup link is here: neovolve.com/2008/01/16/loglevel-nant-taskKirtley

© 2022 - 2024 — McMap. All rights reserved.