ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine Levy-Lambert" <anto...@antbuild.com>
Subject Re: Ant log level
Date Wed, 25 Jun 2003 06:59:26 GMT
Hi Mike,

----- Original Message -----
From: "Mazzolini, Mike" <mike.mazzolini@bankofamerica.com>
To: <user@ant.apache.org>
Sent: Wednesday, June 25, 2003 5:35 AM
> Can someone tell me how to set the log level in an Ant build.

when you are starting the build from the command line, the default is INFO
you can run :
ant -debug
or
ant -verbose
to set the log level to DEBUG or to VERBOSE.

If you are programming, the log level is an attribute of each of the
loggers/listeners which are active on your build.

Antoine
----------------------------------------------------------------------------
----------------------------------------
(you only need this if you want to write your own Java wrappers around ant)
here is a sample program with a default logger set to MSG_INFO

public class testproperty {
    public static void main (String [] argv){

        String filename="/dev/testant/property.xml";
        StringBuffer logBuffer;
        StringBuffer fullLogBuffer;
        Project project=new Project();
        logBuffer = new StringBuffer();
        fullLogBuffer = new StringBuffer();
        project = new Project();
        project.init();
        project.setUserProperty( "ant.file" , new
File(filename).getAbsolutePath() );
        ProjectHelper.configureProject(project, new File(filename));
        project.addBuildListener(createLogger());
        project.executeTarget("testproperty");
    }
    private static BuildLogger createLogger() {
        BuildLogger logger = null;
        logger = new DefaultLogger();
        logger.setMessageOutputLevel(Project.MSG_INFO);
        logger.setOutputPrintStream(System.out);
        logger.setErrorPrintStream(System.err);
        logger.setEmacsMode(false);

        return logger;
    }

}

----------------------------------------------------------------------------
-------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message