ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Stevens <>
Subject Re: [Vote] Logging
Date Wed, 09 May 2001 06:51:01 GMT
on 5/8/01 11:26 PM, "Conor MacNeill" <> wrote:

> In the .antrc file (or .antrc.xml), we should use introspection to configure
> user preferred listeners/loggers.

Ewwww....No! That is what interfaces are for.

Guys, this stuff isn't difficult.

Here is a stripped down example of what I'm talking about taken from


public interface LogSystem
    public void logMessage(int level, String message);

public class LogKitLogSystem implements LogSystem
    public void init()
        // do setup and config stuff here.

     *  logs messages
     *  @param level severity level
     *  @param message complete error message
    public void logMessage(int level, String message)
        switch (level)
            case LogSystem.WARN_ID:
                logger.warn( message );
            case LogSystem.INFO_ID:
            case LogSystem.DEBUG_ID:
            case LogSystem.ERROR_ID:

public class Log4JLogSystem implements LogSystem
    // similar to LogKitSystem, but for Log4J

public class LogManager
    public static LogSystem createLogSystem()
        // create a LogKitSystem or Log4JLogSystem
        LogSystem instance = Class.forName ().newInstance

Now, in Ant, you use LogManager to get an instance of the class you want and
you are done. You can then write a static little wrapper around logMessage
to do something like Log.debug() or hell, put it in the interface!

Why is this so difficult for everyone to comprehend and why does Peter think
that this is re-implementation of stuff??


If you come from a Perl or PHP background, JSP is a way to take
your pain to new levels. --Anonymous

View raw message