NAnt build log shows every element regardless of verbosity settings

How can I get the NAnt build log to show only the actual output from NAnt, not every element that was run.  Our build log is full of this:

[14:59:48]: db-force (running for 1m:26s)
[14:59:48]: [db-force] call (running for 1m:26s)
[14:59:48]: [call] db (running for 1m:26s)
[14:59:48]: [db] call (running for 1m:26s)
[14:59:48]: [call] db-go (running for 1m:26s)
[14:59:48]: [db-go] foreach (running for 1m:26s)
[14:59:48]: [foreach] if (35s)
[14:59:48]: [if] if (35s)
[14:59:48]: [if] if (35s)
[14:59:49]: [if] if (35s)
[14:59:49]: [if] if (34s)
[14:59:49]: [if] foreach (2s)
[14:59:49]: [foreach] if (2s)
[14:59:49]: [if] call (1s)
[14:59:51]: [if] if
[14:59:51]: [if] call
[14:59:51]: [if] if
[14:59:51]: [if] if (32s)
[14:59:52]: [if] call (32s)
[14:59:52]: [call] db-update (32s)
[14:59:52]: [db-update] if (32s)
[14:59:52]: [if] if (32s)
[14:59:52]: [if] foreach (7s)
[14:59:52]: [foreach] foreach (7s)
[14:59:52]: [foreach] if (7s)
[14:59:52]: [if] if (7s)
[14:59:53]: [if] if (6s)
[14:59:54]: [if] if (5s)
[14:59:54]: [if] if (5s)
[14:59:54]: [if] if (5s)
[14:59:55]: [if] if (4s)
[14:59:55]: [if] if (4s)
[14:59:55]: [if] if (3s)
[14:59:56]: [if] if (3s)
[14:59:56]: [if] if (3s)
[14:59:56]: [if] if (2s)

Which makes it almost useless since it's hard to find the actual messages mixed into the thousands of junk messages.  I've tried various command line parameters including:

-verbose- -debug- -q

but I still get the detailed output.

I found this post with no answer:  http://devnet.jetbrains.net/message/5232359

And this post http://devnet.jetbrains.net/message/5259843 refers to issue http://youtrack.jetbrains.net/issue/TW-6189 which is marked as fixed but I still have this problem.   The case seems to be a mix of nant and msbuild so it's not clear what was reported exactly and what was fixed.

I'm using TeamCity Professional Version 5.1.5 (build 13602).

Thanks,

Sam

5 comments

I did some poking around and it seems this comes from JetBrains.BuildServer.NAntLoggers.dll, so it has nothing to do with NAn't verbosity setting or any of it's settings.  It's a TeamCity issue.

For now I've written a utility app to clean out the useless log lines.  I wish this could get fixed though.  At least make it an option.

using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace CleanTeamcityNantLogs
{
     static class Program
     {
          /// <summary>
          /// The main entry point for the application.
          /// </summary>
          static void Main(string[] args)
          {
               if (args.Length == 0)
               {
                    MessageBox.Show("Full path as argument required.  Drop a log file onto this executable.",
                                        "CleanTeamCityNantLogs",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                    return;
               }

               if (args.Any(a => !File.Exists(a)))
               {
                    string[] formatted = args.Select(a => File.Exists(a) ? a : "* " + a).ToArray();
                    string message = String.Format("One of the paths, marked with a *, was not found.\r\n{0}",
                                                          String.Join("\r\n", formatted));
                    MessageBox.Show(message, "CleanTeamCityNantLogs", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
               }

               foreach (string a in args)
               {
                    Clean(a);
               }
          }

          static void Clean(string inPath)
          {
               string outPath = Path.ChangeExtension(inPath, ".clean" + Path.GetExtension(inPath));

               using (var reader = new StreamReader(inPath))
               {
                    using (var writer = new StreamWriter(outPath, false))
                    {
                         string line;

                         while ((line = reader.ReadLine()) != null)
                         {
                              if (!Regex.IsMatch(line, @"^.*\[[\-\w]+\] ([\-\w]+)?$"))
                              {
                                   writer.WriteLine(line);
                              }
                         }
                    }
               }
               Process.Start(outPath);
          }
     }
}
0

Thank you for workaround.

Please check if you change NAnt verbosity from the build script. NAnt listener always check project logging threshold before logging a message.

What is the version of NAnt you use?

0

I'm not sure how to change the verbosity in the build script itself.  I looked through NAnt help, but didn't see anything.

We're using NAnt 0.86.

Thanks,

Sam

0

Samuel,
Have you tried -q+ arguments? If it does not help, please create an issue in our issue tracker at http://youtrack.jetbrains.net with sample NAnt script and resulting build log.

0

Please sign in to leave a comment.