avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leif Mortenson <l...@tanukisoftware.com>
Subject Configuration of the logger used internally by LoggerManagers.
Date Tue, 06 Aug 2002 07:14:09 GMT
I am running into a problem while organizing the log output of Fortress.

I would like to allow the user to configure the logger to be used by the 
for its output.  In the case of fortress, that would be "fortress.logkit"

I can do that by creating the LogKitLoggerManager as follows.
            org.apache.log.Logger lmLogger = hierarchy.getLoggerFor( 
"logkit" );
            LogKitLoggerManager logManager = new LogKitLoggerManager(
                "fortress", hierarchy, new LogKitLogger( lmLogger ) );

The problem with this approach is that the defaultLogger will be set to 
I would really like to be able to set it to "fortress".   This makes it 
very easy to configure
the logger so that all LoggerManager related output is disabled, while 
at the same time
be able to see the output of classes making use of the defaultLogger.

There are two possible solutions.
1) Create a additional constructor which takes a 4th argument:
    public LogKitLoggerManager( final String prefix, final Hierarchy 
        final Logger defaultLogger, final Logger logger )
        m_prefix = prefix;
        m_hierarchy = hierarchy;
        m_defaultLogger = defaultLogger;
        m_logger = logger;
    This is the approach that I prefer as it enables me to set the 
internal logger to the default value
    to maintain compatability.

2) Modify either LoggerManager or the individual implementations to 
implement LoggedEnabled
    the calling code would then call enableLogging like any other object 
to set the internal logger.
    Once again for backwards compatability, the internal logger would be 
set to the default
    logger by default.  This has the risk of getting some different 
functionality if the instance passes
    though any container code which does an if instanceof LoggedEnabled 


To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>

View raw message