Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty + Slf4j

Oh! I understand now!
slf4j thinks that there are multiple bindings but in fact in terms of
classes that it can load there is a single binding!
And I assumed that protecting org.slf4j was not protecting
org.slf4j.impl. But that is not the case: it protects all the children
packages too.

Thanks for raising the bug and for the patient explanations.
Hugues


On Wed, Dec 9, 2009 at 5:37 PM, Jan Bartel <janb@xxxxxxxxxxx> wrote:
> Hi Hugues,
>
> Yes, its just a warning.
>
> The real fix is for jetty's WebAppClassLoader to apply the same masking
> rules
> (systemClasses, serverClasses) it uses for finding classes to finding
> resources.
>
> So, when LoggerFactory calls
> getClassLoader().getResources("org/slf4j/impl/StaticLoggerBinder.class");
> the serverClasses masking rules would be applied and voila, you would not
> see the
> class file in the server's classpath.
>
> I've raised this bugzilla for it:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=297421
>
> BTW, by default "org.apache.commons.logging.", "org.apache.log4j." are
> protected.
>
> cheers
> Jan
>
>
> Hugues Malphettes wrote:
>>
>> It is a warning: http://www.slf4j.org/codes.html#multiple_bindings
>>
>> http://github.com/ceki/slf4j/blob/master/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java#L114
>>
>> http://github.com/ceki/slf4j/blob/master/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java#L212
>>
>> In my naive opinion if we are manipulating the classpath to isolate
>> org.slf4j in the server from the org.slf4j in the webapp.
>> Then we must do the same for org.sl4j.impl
>>
>> That will really help.
>>
>> In fact I would consider isolating org.apache.commons.logging,
>> org.apache.log4j and org.apache.log4j.spi while we are at it.
>>
>> Forget it if it is a poor idea :)
>>
>> Hugues
>>
>> On Wed, Dec 9, 2009 at 2:20 PM, Greg Wilkins <gregw@xxxxxxxxxxx> wrote:
>>>
>>> Jan Bartel wrote:
>>>
>>>> Having upgraded to 1.5.8 of slf4j (I was using an old 1.3.1!) I can now
>>>> reproduce the situation with the "SLF4J: Class path contains multiple
>>>> SLF4J bindings." messages.
>>>
>>> Ceki Nooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo!
>>>
>>> This was one of the stupid things about commons-logging that made us
>>> drop it after jetty-5.    It went hunting around the complex classloading
>>> structure of the application server to find multiple copies of itself
>>> and failed if it found them.
>>>
>>> Hopefully this is only a warning.
>>>
>>> cheers
>>>
>
> --
> Jan Bartel, Webtide LLC | janb@xxxxxxxxxxx | http://www.webtide.com
>


Back to the top