This solution seems to work, thanks. But I have to test it a little bit more. 
If  a compile error occurs, the error message must be logged.

I wished that this task would be a standard Ant task (out of the box).

By the way, for the CVS task, there is a reallyquiet parameter, which is 
supported by Ant as well.

Exec tasks I have silenced with 1>nul 2>nul


"Rebhan, Gilbert" <[EMAIL PROTECTED]> wrote: 

You could take this simple task =

public class SetLogLevel extends Task
{
    private int logLevel = -1;

    public void execute()
    {
        if (logLevel == -1)
        {
            throw new BuildException("Error - No Loglevel specified !!");
        }
        Vector listeners = this.getProject().getBuildListeners();
        for (Iterator i = listeners.iterator(); i.hasNext();)
        {
            BuildListener listener = (BuildListener) i.next();
            if (listener instanceof BuildLogger)
            {
                BuildLogger logger = (BuildLogger) listener;
                logger.setMessageOutputLevel(logLevel);
            }
        }
    }

    /**
     * 
     *  @see org.apache.tools.ant.taskdefs.Echo$EchoLevel
     * 
     */
    
    public void setLevel(EchoLevel echoLevel) {
        String option = echoLevel.getValue();
        if (option.equals("error")) {
            logLevel = Project.MSG_ERR;
        } else if (option.equals("warning")) {
            logLevel = Project.MSG_WARN;
        } else if (option.equals("info")) {
            logLevel = Project.MSG_INFO;
        } else if (option.equals("verbose")) {
            logLevel = Project.MSG_VERBOSE;
        } else {
            // must be "debug"
            logLevel = Project.MSG_DEBUG;
        }
    }
}


map it to a taskdef and use it like that =



... your javac stuff goes here ... only errors should be listed

and afterwards set the default noiselevel again.





That's what i do to shorten logfiles when using talkative tasks like f.e. 


Regards, Gilbert

 

-----Original Message-----
From: Hans Schwaebli [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 08, 2006 2:39 PM
To: Ant Users List
Subject: Re: How to silence javac task?

Please reply someone cause it is really important for us. Thanks.
  

Hans Schwaebli  wrote:
  I already use this. If I wouldn't, it would be much worse. But it doesn't 
silence javac's output message which I described.

Any other ideas?


Public Id 
wrote: Hans Schwaebli wrote: So how can I get rid of these warnings? How can I 
influence javac task not to print anything?

You could try adding nowarn="true" to your javac task.


---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates 
starting at 1¢/min.


---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates 
starting at 1¢/min.

   
---------------------------------
Do you Yahoo!?
 Everyone is raving about the  all-new Yahoo! Mail Beta.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



                
---------------------------------
Do you Yahoo!?
 Everyone is raving about the  all-new Yahoo! Mail Beta.

Reply via email to