avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anton Tagunov <atagu...@mail.cnt.ru>
Subject Re: cvs commit: avalon/fortress/container/src/impl/org/apache/avalon/fortress/impl AbstractContainer.java
Date Sat, 28 Jun 2003 22:41:41 GMT
Hello, Marcus!

cao>   Enable logging for component handlers

cao>   avalon/fortress/container/src/impl/org/apache/avalon/fortress/impl/AbstractContainer.java

cao>                // do the handler lifecycle
cao>   +            ContainerUtil.enableLogging( targetHandler, getLogger() );
cao>                ContainerUtil.contextualize( targetHandler, m_context );

Great you've spotted this! You patch has also made me see that there
still is more cleanup to do, look:

public abstract class AbstractComponentHandler
    extends AbstractLogEnabledInstrumentable ...
{
    ...
    
    protected LoggerManager m_loggerManager;
    protected Logger m_logger;

    public void service( final ServiceManager manager ) ...
    {
        m_loggerManager =
            (LoggerManager) manager.lookup( LoggerManager.ROLE );
        ...
    }
    ...

    public void initialize() ...
    {
        m_logger =
            m_loggerManager.getLoggerForCategory( categoryName );
        ...
    }
    ...
}

AbstractContainer has

            final DefaultServiceManager serviceManager =
                    new DefaultServiceManager( getServiceManager() );
            serviceManager.put( ObjectFactory.ROLE, factory );
            serviceManager.makeReadOnly();

            ContainerUtil.service( targetHandler, serviceManager );

What do we see?

1) AbstractComponentHandler both
   * is AbstractLogEnabledInstrumentable
   * has it's own m_logger
   
2) It sort of enables its own logging but as late as
   in service() method

3) While it expects to find a LoggerManager in service()
   AbstractContainer fails to push it there

There is also one thing I like about this all: to me it makes
sense to use a different logging category for the handlers then
for the container itself.

I'm at doubt what to do, but clearly some cleanup is still pending :)

-Anton


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


Mime
View raw message