How can I get the logger to log on my package?

View: New views
4 Messages — Rating Filter:   Alert me  

How can I get the logger to log on my package?

by Anders Hammar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

My (Plexus component) class implements LogEnabled and I use the logger
set through the enableLogging() method. However, when logging, it's
not done in the context of my package but the package of (I think) the
role of the component. Is there a way of changing this? The reason for
doing that is to only enable, for example, debug logging for my
component and not every plugin component of the same kind (role).

/Anders

---------------------------------------------------------------------
To unsubscribe, e-mail: nexus-dev-unsubscribe@...
For additional commands, e-mail: nexus-dev-help@...


Re: How can I get the logger to log on my package?

by Tamas Cservenak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

within Plexus, you are not "doomed" to use PlexusLogger at all. In  
your case, you could remove the LogEnabled iface from you component,  
and use Slf4J Logger directly (this is what Nexus uses "under the  
hud") to achieve what you want...

Currently, the "backend" for Slf4j is Log4j, but I would recommend to  
not go that low, Slf4j is the best "common denominator".

Hope helps,
~t~

On 2 Apr 2009, at 22:18, Anders Hammar wrote:

> Hi,
>
> My (Plexus component) class implements LogEnabled and I use the logger
> set through the enableLogging() method. However, when logging, it's
> not done in the context of my package but the package of (I think) the
> role of the component. Is there a way of changing this? The reason for
> doing that is to only enable, for example, debug logging for my
> component and not every plugin component of the same kind (role).
>
> /Anders
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: nexus-dev-unsubscribe@...
> For additional commands, e-mail: nexus-dev-help@...
>


---------------------------------------------------------------------
To unsubscribe, e-mail: nexus-dev-unsubscribe@...
For additional commands, e-mail: nexus-dev-help@...


Re: How can I get the logger to log on my package?

by Anders Hammar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Tamas!

So the behavior I see is the "correct" behavior for PlexusLogger? I'm
thinking that it's not what one would expect. When you turn on
logging, you want to do that for a specific implementation, but for an
interface.
I guess this is more of a Plexus question than a Nexus one though...

My 2 cents,
/Anders

On Fri, Apr 3, 2009 at 11:09, Tamas Cservenak <cstamas@...> wrote:

> Hi,
>
> within Plexus, you are not "doomed" to use PlexusLogger at all. In your
> case, you could remove the LogEnabled iface from you component, and use
> Slf4J Logger directly (this is what Nexus uses "under the hud") to achieve
> what you want...
>
> Currently, the "backend" for Slf4j is Log4j, but I would recommend to not go
> that low, Slf4j is the best "common denominator".
>
> Hope helps,
> ~t~
>
> On 2 Apr 2009, at 22:18, Anders Hammar wrote:
>
>> Hi,
>>
>> My (Plexus component) class implements LogEnabled and I use the logger
>> set through the enableLogging() method. However, when logging, it's
>> not done in the context of my package but the package of (I think) the
>> role of the component. Is there a way of changing this? The reason for
>> doing that is to only enable, for example, debug logging for my
>> component and not every plugin component of the same kind (role).
>>
>> /Anders
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: nexus-dev-unsubscribe@...
>> For additional commands, e-mail: nexus-dev-help@...
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: nexus-dev-unsubscribe@...
> For additional commands, e-mail: nexus-dev-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: nexus-dev-unsubscribe@...
For additional commands, e-mail: nexus-dev-help@...


Re: How can I get the logger to log on my package?

by Tamás Cservenák :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes,
Plexus logging is one of the most controversial thing in Plexus, at least it brought up many question and cents :)

Personally, I don't care. If you don't like it, don't use it :)

~t~

On Fri, Apr 3, 2009 at 12:11 PM, Anders Hammar <anders@...> wrote:
Thanks Tamas!

So the behavior I see is the "correct" behavior for PlexusLogger? I'm
thinking that it's not what one would expect. When you turn on
logging, you want to do that for a specific implementation, but for an
interface.
I guess this is more of a Plexus question than a Nexus one though...

My 2 cents,
/Anders

On Fri, Apr 3, 2009 at 11:09, Tamas Cservenak <cstamas@...> wrote:
> Hi,
>
> within Plexus, you are not "doomed" to use PlexusLogger at all. In your
> case, you could remove the LogEnabled iface from you component, and use
> Slf4J Logger directly (this is what Nexus uses "under the hud") to achieve
> what you want...
>
> Currently, the "backend" for Slf4j is Log4j, but I would recommend to not go
> that low, Slf4j is the best "common denominator".
>
> Hope helps,
> ~t~
>
> On 2 Apr 2009, at 22:18, Anders Hammar wrote:
>
>> Hi,
>>
>> My (Plexus component) class implements LogEnabled and I use the logger
>> set through the enableLogging() method. However, when logging, it's
>> not done in the context of my package but the package of (I think) the
>> role of the component. Is there a way of changing this? The reason for
>> doing that is to only enable, for example, debug logging for my
>> component and not every plugin component of the same kind (role).
>>
>> /Anders
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: nexus-dev-unsubscribe@...
>> For additional commands, e-mail: nexus-dev-help@...
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: nexus-dev-unsubscribe@...
> For additional commands, e-mail: nexus-dev-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: nexus-dev-unsubscribe@...
For additional commands, e-mail: nexus-dev-help@...