Bug 16131 - not possible to suppress "BUILD SUCCESSFUL" message
Summary: not possible to suppress "BUILD SUCCESSFUL" message
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Build Process (show other bugs)
Version: 1.5.1
Hardware: PC All
: P3 enhancement with 4 votes (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2003-01-15 19:10 UTC by T. Paul McCartney
Modified: 2010-06-12 15:39 UTC (History)
1 user (show)

Adds a new argument -veryquiet which suppresses "Build Successful" message and outputs nothing on no errors and warnings. (3.04 KB, patch)
2010-06-03 00:08 UTC, terwork
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description T. Paul McCartney 2003-01-15 19:10:28 UTC
If I execute a build command, I would like to suppress unnecessary output.  I 
only want to see errors and warnings.

When I do "ant -quiet -emacs >2 /dev/null" I can suppress nearly all non-error, 
non-warning output, but I still get messages like:

Total time: 11 seconds

Which I think should be suppressed as part of "-quiet".
Comment 1 Dominique Devienne 2003-01-15 19:18:52 UTC
No much changes in Ant that breaks backward compatibility / behavior...

Sounds like you want a new -readquiet or -silent switch that also suppresses 
the 'BUILD SUCCESSFUL / FAILED' & 'Total time' lines. Of course, you'd get a 
better chance to have it appear in Ant if you provide a patch for it ;-) --DD
Comment 2 T. Paul McCartney 2003-01-15 20:25:06 UTC
Changing the "buildFinished" method in "org.apache.tools.ant.DefaultLogger" to 
the following fixes the issue.  If msgOutputLevel is "error" or "warning" 
(i.e., as with -quiet), the message is suppressed.  Otherwise, it will be 
printed normally.

    public void buildFinished(BuildEvent event) {
        Throwable error = event.getException();
        StringBuffer message = new StringBuffer();

        if (error == null) {
            if (msgOutputLevel > Project.MSG_WARN) {
                message.append("BUILD SUCCESSFUL");
        } else {
            message.append("BUILD FAILED");

            if (Project.MSG_VERBOSE <= msgOutputLevel ||
                !(error instanceof BuildException)) {
            } else {
                if (error instanceof BuildException) {
                } else {
        if (msgOutputLevel > Project.MSG_WARN) {
            message.append("Total time: ");
            message.append(formatTime(System.currentTimeMillis() - startTime));

        String msg = message.toString();
        if (error == null) {
          if (msg.length() > 0) {
              printMessage(msg, out, Project.MSG_VERBOSE);
        } else {
            printMessage(msg, err, Project.MSG_ERR);
Comment 3 Conor MacNeill 2003-01-15 22:17:43 UTC
Why not just create your own logger?
Comment 4 T. Paul McCartney 2003-01-17 15:34:33 UTC
You could create your own logger, but it just seems like it you specify "-
quiet", the correct behavior should be to suppress unnecessary messages.

Another possibility would be to have ant send errors and warnings to System.err 
rather than System.out.  That way I could just say "ant -emacs 1> /dev/null" 
and only the errors and warnings would go to the console.
Comment 5 Nils Meier 2004-12-11 17:30:43 UTC
I second this request - I'm calling ant from as a cronjob on sourceforge and get
an email if anything is printed to stdout. By specifying -quiet (or possibly a
new -veryquiet) I'd expect ant to not report the 'information'-level message:

Total time: 34 seconds

Supressing this message should be supported (it's a trivial fix as posted in
another comment) so not everyone automating with ant has to write his/her own

Comment 6 terwork 2010-06-03 00:08:22 UTC
Created attachment 25511 [details]
Adds a new argument -veryquiet which suppresses "Build Successful" message and outputs nothing on no errors and warnings.

I know this is an old bug, and nobody wanted to change existing functionality. But it was trivial and just waiting to be done, so I did it. The patch I'm submitting takes a new "-veryquiet" argument which suppresses all messages if there are no errors or warnings.
Comment 7 Jesse Glick 2010-06-08 14:58:43 UTC
I would agree that the existing -quiet argument ought to be fixed, rather than introducing a new option.
Comment 8 terwork 2010-06-12 15:39:35 UTC
I was going to do the same thing, but thought that preserving backward behavior is a better idea. Here's what I'll do: I'm going to submit a new patch, and let the core members decide. Given that this design decision has not been resolved in 8 years though, I don't think that this'll be resolved soon.