[logback-user] Logback 1.3.0/1.4.0 : slf4j-api & StaticLoggerBinder

Ceki Gülcü ceki at qos.ch
Thu Sep 1 22:31:44 CEST 2022


Hi Nigel,

I think your analysis is correct. The issue is related to Spring Boot's
support for SLF4J 2.0. The dependency tree [1] you provided shows
several components which cater for SLF4J 1.7.x such as

org.apache.logging.log4j:log4j-to-slf4j:jar
org.slf4j:jul-to-slf4j:jar:1.7.36

Spring Boot is slated to support SLF4J 2.0 sometime in the near future [2].

I hope this helps,

-- 
Ceki Gülcü

Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch


[1] https://github.com/odpi/egeria/issues/6884#issuecomment-1234136658
[2] https://github.com/spring-projects/spring-boot/issues/12649

On 9/1/2022 3:53 PM, Nigel L Jones wrote:
> Ok, so that ref to ServiceLoader really helped, and I figured my issue
> looks like
> 
> https://github.com/spring-projects/spring-boot/issues/32182
> <https://github.com/spring-projects/spring-boot/issues/32182>
> 
> So thanks for the tip!
> 
>  
> 
> *From: *Nigel L Jones <jonesn at uk.ibm.com>
> *Date: *Thursday, 1 September 2022 at 14:49
> *To: *logback users list <logback-user at qos.ch>
> *Subject: *Re: [EXTERNAL] Re: [logback-user] Logback 1.3.0/1.4.0 :
> slf4j-api & StaticLoggerBinder
> 
> Thanks,
> I did try 1.3 with the same results. Mostly Jakarta, but some javax via
> transitive dependencies.
> 
> 
> The server applications use spring (springboot 2.7.3/spring 5.3.22), so
> that may be the area to persue as spring introduces it’s own classloader
> and may cause problems with ServiceLoader?? –via the spring community so
> thanks for the pointer.
> 
>  
> 
> *From: *logback-user <logback-user-bounces at qos.ch> on behalf of Raymond
> Augé <raymond.auge at liferay.com>
> *Date: *Thursday, 1 September 2022 at 14:15
> *To: *logback users list <logback-user at qos.ch>
> *Subject: *[EXTERNAL] Re: [logback-user] Logback 1.3.0/1.4.0 : slf4j-api
> & StaticLoggerBinder
> 
> Hi Nigel, You probably want logback 1. 3 (1. 4 is for Jakarta EE as
> opposed to 1. 3 being for Java EE). Secondly, logback now uses
> ServiceLoader to find "providers" so make sure any adjustments are made
> to your classloading such that
> 
> 
> *This Message Is From an External Sender *
> 
> This message came from outside your organization.
> 
> ZjQcmQRYFpfptBannerEnd
> 
> Hi Nigel,
> 
>  
> 
> You probably want logback 1.3 (1.4 is for Jakarta EE as opposed to 1.3
> being for Java EE).
> 
> 
> Secondly, logback now uses ServiceLoader to find "providers" so make
> sure any adjustments are made to your classloading such that that can work.
> 
>  
> 
> Cheers
> 
>  
> 
> On Thu, Sep 1, 2022 at 7:59 AM Nigel L Jones <jonesn at uk.ibm.com
> <mailto:jonesn at uk.ibm.com>> wrote:
> 
>     Hi,
>     I’m a maintainer on the open source Egeria project
>     https://github.com/odpi/egeria <https://github.com/odpi/egeria>.
> 
> 
>      We typically use slf4j in our Java 11 code, and depend on
>     slf4j-api. Then in any ‘applications’ (a client tool, or a server)
>     we include an implementation for logging, such as logback –
>     specifically logback-classic
> 
>     We regularly update our dependencies and today I tried upgrading
>     from logback 1.2.11 to 1.4.0. On doing so I see we now fail to
>     startup, as slf4j is unable to find a logging implementation. Slf4j
>     is at 2.0.0. We get an exception
> 
>     Caused by: java.lang.NoClassDefFoundError:
>     org/slf4j/impl/StaticLoggerBinder
> 
> 
>     Whilst this is an slf4j config issue in most regards, I wonder if
>     the new logback version is not keeping slf4j happy with its
>     implementation in some way
> 
>     I opened up an issue in our own bug tracker at
>     https://github.com/odpi/egeria/issues/6884
>     <https://github.com/odpi/egeria/issues/6884> which has the
>     dependency tree & stack trace in full.
> 
>     Is there a change in the new version that’s caught us out? Any
>     indications from the log? (If it is a logback issue happy to open up
>     a bug report, but now knowing logback well figured I’d ask here first!)
> 
>     Many thanks
>     Nigel Jones
> 
> 
> 
> -- 
> 
> *Raymond Augé* (@rotty3000)
> 
> Senior Software Architect *Liferay, Inc.* (@Liferay)
> 
> OSGi Fellow, Java Champion
> 


More information about the logback-user mailing list