ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: How to silence javac task?
Date Tue, 08 Aug 2006 12:56:12 GMT


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 =

<setloglevel level="error" />

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

and afterwards set the default noiselevel again.

<setloglevel level="info" />



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


Regards, Gilbert

 

-----Original Message-----
From: Hans Schwaebli [mailto:hans_schwaebli@yahoo.com] 
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 <hans_schwaebli@yahoo.com> 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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message