开发者

Suppressing Log Output for NAnt Delete Task

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 .. ?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜