Title: RE: ExcaliburComponentManager question

Hi Charles,

the ECM does not recognize the LogEnabled interface till now! You still have to use the Loggable interface (extending AbstractLoggable) instead. Otherwise the component will not get parsed a logger. The newInstance method of the default factory handels this for the ECM with this code:

        if( component instanceof Loggable )
        {
            if( null == m_logkit )
            {
                ((Loggable)component).setLogger( getLogger() );
            }
            else if( m_configuration == null )
            {
                ((Loggable)component).setLogger( getLogger() );
            }
            else
            {
                final String logger = m_configuration.getAttribute( "logger", null );
                if( null == logger )
                {
                    getLogger().debug( "no logger attribute available, using standard logger" );
                    ((Loggable)component).setLogger( getLogger() );
                }
                else
                {
                    getLogger().debug( "logger attribute is " + logger );
                    ((Loggable)component).setLogger( m_logkit.getLogger( logger ) );
                }
            }
        }

Adding something like the following to the Factory would avoid the NPE and parse the Logger of the ECM at least to your component I think:

+       if ( component instanceof LogEnabled )
+       {
+            ((LogEnabled)component).enableLogging( new LogKitLogger( getLogger() ) );         
+       }

But still the LogKitManagement only can handle LogKit and not the new abstracted Logger interface from Framework (I think)...

Hope this helps ...
(Hmmm what about this patch above? Will this work?)


Michael


> -----Original Message-----
> From: Charles Yates [mailto:[EMAIL PROTECTED]]
> Sent: Friday, December 14, 2001 12:31 AM
> To: avalon-dev@jakarta.apache.org
> Subject: ExcaliburComponentManager question
>
>
> Hello,
>     Is an ExcaliburComponentManager that has a LogKitManager
> supposed to
> automatically set the logger of components?  The
> documentation seems to
> suggest this, but it is not working for me.  I'm not sure if it is not
> happening because I've got things set up incorrectly, or
> because I must
> explicitly set the logger.  My components extend
> AbstractLogEnabled and
> their <component> elements contain a logger attribute.  The component
> and logger instances are being created, but myComponent.getLogger()
> returns null. Thanks for any help.
>
> Charles
>
>
>
>
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>

----------------------------------------- (on the network)

*********************************
PRIVILEGED - PRIVATE AND CONFIDENTIAL
This e-mail and files transmitted with it are intended solely for the
use of the addressee(s) and may contain information which is
confidential or privileged. If you are not the intended recipient, be
aware that any disclosure, copying, distribution or use of this e-mail
or any attachment is prohibited. If you receive this e-mail and you are
not the addressee, or you have received this e-mail in error, please
disregard the contents of the e-mail, delete the e-mail and notify the
author immediately.
*********************************


---------------------------------------------------------

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to