You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Norman Maurer <nm...@byteaction.de> on 2006/07/12 21:34:33 UTC

slf4j and avalon

Hi guys ( Peter ;-)),

anyone had get it to work to get the slf4j logs logged with avalon ? I
know there is a wrapper. If it works like aspected we will maybe switch
to  slfj for jSPF ..

bye
Norman

Re: slf4j and avalon

Posted by Stefano Bagnara <ap...@bago.org>.
Noel J. Bergman wrote:
>> I have a library using slf4j for logging and I want to use it inside my
>> Avalon based application (Apache James).
> 
> We should use java.util.logging, which is also what tomcat switched to
> using.  JULI should be entirely sufficient for our needs, and is the
> standard API.
> 
> 	--- Noel

Tomcat is moving to java.util.logging because JCL has big classloader 
issues.

Does JUL give us the possibility to log things to the current component 
logger (where for Logger I mean an Avalon Logger or a custom JamesLogger 
injected via setLogger or in the constructor of the component).

About jSPF I'm currenlty:

+1 to remove LOG4J (I always rejected direct Log4j dependency, but it 
was the easies path at that time, and I'm all for agility)

And here my alternatives:

+0.5 to switch to SLF4J

+0.8 to create a simple Logger interface+service under JSPF and have it 
specifiable in the constructor (like we already do for the DNS 
implementation). In this scenario the default implementation could be 
JUL and we could add easily an implementation over Avalon Loggers to 
have a good integration with the SPFHandler.

If you don't have static code imo the injected Logger service is the 
best solution: its bigger limitation is that it does not provide a 
solution for static things.

Even the other frameworks have big problem with logging inside static 
methods and classloading issues, that in the end are solved mainly 
looking up for a new logger at each method call or passing the logger to 
the method. The last solution would be applicable to Injected Loggers 
also, the first not.

Stefano


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


Re: slf4j and avalon

Posted by Norman Maurer <nm...@byteaction.de>.
Am Donnerstag, den 13.07.2006, 10:43 +0200 schrieb Stefano Bagnara:
> Noel J. Bergman wrote:
> >> I have a library using slf4j for logging and I want to use it inside my
> >> Avalon based application (Apache James).
> > 
> > We should use java.util.logging, which is also what tomcat switched to
> > using.  JULI should be entirely sufficient for our needs, and is the
> > standard API.
> > 
> > 	--- Noel
> 
> Tomcat is moving to java.util.logging because JCL has big classloader 
> issues.
> 
> Does JUL give us the possibility to log things to the current component 
> logger (where for Logger I mean an Avalon Logger or a custom JamesLogger 
> injected via setLogger or in the constructor of the component).
> 
> About jSPF I'm currenlty:
> 
> +1 to remove LOG4J (I always rejected direct Log4j dependency, but it 
> was the easies path at that time, and I'm all for agility)

+1 
But first i want to release 0.9b1.. We can do this for 0.9b2 .

> 
> And here my alternatives:
> 
> +0.5 to switch to SLF4J
> 
> +0.8 to create a simple Logger interface+service under JSPF and have it 
> specifiable in the constructor (like we already do for the DNS 
> implementation). In this scenario the default implementation could be 
> JUL and we could add easily an implementation over Avalon Loggers to 
> have a good integration with the SPFHandler.

+1 this sounds like the best way of integration..

> 
> If you don't have static code imo the injected Logger service is the 
> best solution: its bigger limitation is that it does not provide a 
> solution for static things.
> 
> Even the other frameworks have big problem with logging inside static 
> methods and classloading issues, that in the end are solved mainly 
> looking up for a new logger at each method call or passing the logger to 
> the method. The last solution would be applicable to Injected Loggers 
> also, the first not.
> 
> Stefano

bye
Norman

RE: slf4j and avalon

Posted by "Noel J. Bergman" <no...@devtech.com>.
> I have a library using slf4j for logging and I want to use it inside my
> Avalon based application (Apache James).

We should use java.util.logging, which is also what tomcat switched to
using.  JULI should be entirely sufficient for our needs, and is the
standard API.

	--- Noel


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


Re: slf4j and avalon

Posted by Stefano Bagnara <ap...@bago.org>.
I wrote this to slf4j-users mailing list one month ago, but I received 
no answers:
----------------------------
Hi all,

I have a library using slf4j for logging and I want to use it inside my
Avalon based application (Apache James).

I would like to write a wrapper to log things from the library to my
Avalon Logger (currently implemented on LogKit, but this should not be
important).

Logging in Avalon in handled in a IoC way: every component has an
enableLogging(Logger l) method called by the container. Logger is a
service provided by the container itself.

I have no ideas for solutions to this problem.

Any hint?

Stefano
-----------------------------

Norman Maurer wrote:
> Hi guys ( Peter ;-)),
> 
> anyone had get it to work to get the slf4j logs logged with avalon ? I
> know there is a wrapper. If it works like aspected we will maybe switch
> to  slfj for jSPF ..
> 
> bye
> Norman



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


Re: slf4j and avalon

Posted by peter royal <pr...@apache.org>.
On Jul 12, 2006, at 5:15 PM, Stefano Bagnara wrote:
> peter royal wrote:
>> On Jul 12, 2006, at 3:34 PM, Norman Maurer wrote:
>>> anyone had get it to work to get the slf4j logs logged with  
>>> avalon ? I
>>> know there is a wrapper. If it works like aspected we will maybe  
>>> switch
>>> to  slfj for jSPF ..
>> You'll probably want to make a wrapper similar to how commons- 
>> logging works with Avalon.
>
> I found a wrapper that allow you to provide an Avalon Logger  
> implemented over commons-logging but now viceversa.
>
> The fact is that we have an AvalonLogger instance and we want the  
> library to use that specific instance: is it possible?

perhaps, via classloader isolation.

> I really like the Avalon Logger way to manage loggers via DI as any  
> other service and I don't understand why most logging libraries  
> works with static factories.

i agree :)

-pete


-- 
proyal@apache.org - http://fotap.org/~osi




Re: slf4j and avalon

Posted by Stefano Bagnara <ap...@bago.org>.
peter royal wrote:
> On Jul 12, 2006, at 3:34 PM, Norman Maurer wrote:
>> anyone had get it to work to get the slf4j logs logged with avalon ? I
>> know there is a wrapper. If it works like aspected we will maybe switch
>> to  slfj for jSPF ..
> 
> You'll probably want to make a wrapper similar to how commons-logging 
> works with Avalon.

I found a wrapper that allow you to provide an Avalon Logger implemented 
over commons-logging but now viceversa.

The fact is that we have an AvalonLogger instance and we want the 
library to use that specific instance: is it possible?

Do we have to write a static registry of avalon loggers associated with 
library instances and have the slf facade implementation look up this 
registry for each call to getLogger() ?

> With that said, if you're thinking of MINA, I've been pondering pulling 
> out SLF4J and having our own abstraction, as others have wondered why 
> we're not using JCL (and I'm not keen on that for its warts, at least as 
> a requirement in the core)
> 
> -pete

I think that removing slf4j in favor of jcl makes no sense.
I really like the Avalon Logger way to manage loggers via DI as any 
other service and I don't understand why most logging libraries works 
with static factories.

Stefano


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


Re: slf4j and avalon

Posted by peter royal <pr...@apache.org>.
On Jul 12, 2006, at 3:34 PM, Norman Maurer wrote:
> anyone had get it to work to get the slf4j logs logged with avalon ? I
> know there is a wrapper. If it works like aspected we will maybe  
> switch
> to  slfj for jSPF ..

You'll probably want to make a wrapper similar to how commons-logging  
works with Avalon.

With that said, if you're thinking of MINA, I've been pondering  
pulling out SLF4J and having our own abstraction, as others have  
wondered why we're not using JCL (and I'm not keen on that for its  
warts, at least as a requirement in the core)

-pete


-- 
proyal@apache.org - http://fotap.org/~osi