axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Roder <mro...@wamnet.com>
Subject Convention on name of log4j categories
Date Tue, 02 Oct 2001 02:58:24 GMT

One convention I have used in the past is to name my main log4j category of
a class "LOG".  It is shorter, reads a little easier, and even non log4j
users can understand what it is doing without learning what a Category is.
It is also easier to spell!

So this code in FaultableHandler would go from:

    static Category category =
            Category.getInstance(FaultableHandler.class.getName());

    public void undo(MessageContext msgContext) {
        category.debug("Enter: FaultableHandler::undo" );
        workHandler.undo( msgContext );
        category.debug("Exit: FaultableHandler::undo" );
    };

TO:

    static Category LOG =
            Category.getInstance(FaultableHandler.class.getName());

    public void undo(MessageContext msgContext) {
        LOG.debug("Enter: FaultableHandler::undo" );
        workHandler.undo( msgContext );
        LOG.debug("Exit: FaultableHandler::undo" );
    };


It also makes logic easier to read if there is more complex logic to be
opted in/out. Example:

...
    if (LOG.isDebugEnabled()){
        //longer code goes here
    }

Just a couple of cents thrown out there.


Later

Mark
    

Mime
View raw message