You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by "Ghorpade, Rajendra" <RG...@onebridge.de> on 2002/03/07 17:47:01 UTC

Patch for DefaultLogTargetFactoryManager (wrong sequence of lifec ycle calls)

Hi,

it seems to me that the DefaultLogTargetFactoryManager calls the lifecycle
methods on the TargetFactories it creates in the wrong sequence.
It is mixing up configure and contextualize, so I would suggest the
following patch within the Managers configure method:

            if( logTargetFactory instanceof LogEnabled )
            {
                ((LogEnabled) logTargetFactory).enableLogging( getLogger()
);
            }

-            if( logTargetFactory instanceof Configurable )
-            {
-                ((Configurable) logTargetFactory).configure( confs[i] );
-            }

            if( logTargetFactory instanceof Contextualizable )
            {
                try
                {
                    ((Contextualizable) logTargetFactory).contextualize(
m_context );
                }
                catch( final ContextException ce )
                {
                    throw new ConfigurationException( "cannot contextualize
LogTargetFactory " + factoryClass, ce );
                }
            }

+            if( logTargetFactory instanceof Configurable )
+            {
+                ((Configurable) logTargetFactory).configure( confs[i] );
+            }

            if( logTargetFactory instanceof LogTargetFactoryManageable )
            {
                ((LogTargetFactoryManageable)
logTargetFactory).setLogTargetFactoryManager( this );
            }

            if( getLogger().isDebugEnabled() )
            {
                getLogger().debug( "added new LogTargetFactory of type " +
factoryType );
            }
            m_factories.put( factoryType, logTargetFactory );



Regards, Raj

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>