You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Kerry Todyruik <ke...@todyruik.com> on 2001/12/06 00:57:43 UTC

Logging in Non-Component Classes

Could somebody post an example with some explanation of logging using
LogKit in a class that is not a Component?  (A class called from a
Component)

What is the proper way to code this?

Thanks,
Kerry Todyruik


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


Re: Logging in Non-Component Classes

Posted by Eung-ju Park <co...@apache.org>.
----- Original Message -----
From: "Kerry Todyruik" <ke...@todyruik.com>
To: <av...@jakarta.apache.org>
Sent: Thursday, December 06, 2001 8:57 AM
Subject: Logging in Non-Component Classes


> Could somebody post an example with some explanation of logging using
> LogKit in a class that is not a Component?  (A class called from a
> Component)
>
> What is the proper way to code this?

LogKit is independent to Component.

How about

public class NotComponent
    extends AbstractLogEnabled
{
    ...
    public void doSomething()
    {
        getLogger().info( "Hello" );
    }
}

or

public class NotComponent
{
    Logger m_logger;

    ...

    public NotComponent( final Logger logger )
    {
        m_logger = logger;
    }

    ...

    public void doSomething()
    {
        m_logger.info( "Hello" );
    }
}

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


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


Re: Logging in Non-Component Classes

Posted by Peter Donald <pe...@apache.org>.
On Thu, 6 Dec 2001 10:57, Kerry Todyruik wrote:
> Could somebody post an example with some explanation of logging using
> LogKit in a class that is not a Component?  (A class called from a
> Component)
>
> What is the proper way to code this?

Personally I would still pass the logger to the other class via 
LogEnabled/Loggable or if that is not possible in the parameters of one of 
the methods.

-- 
Cheers,

Pete

------------------------------------------
I just hate 'yes' men, don't you Smithers?
------------------------------------------

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