[slf4j-user] slf4j with logback?

Ole Ersoy ole.ersoy at gmail.com
Fri Oct 7 06:11:25 CEST 2011


I'm back (For those that have seen the previous messages).  I'm now trying to incorporate the jcl-slf4j bridge.  Maven pulls sfl4j-1.5.0 transitively for logback 0.9.9.  So I assume I should be using jcl-over-slf4j version 1.5.0.  however there is no such version in the maven repository.  The documentation says to do this:

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
			<version>1.6.2</version>
		</dependency>

But if I do that I get the following:

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
         at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
         at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)

Thoughts?

TIA,
- Ole  



On 10/06/2011 09:25 PM, Ole Ersoy wrote:
> Hi,
>
> I think the solution is to just include the logback-0.9.9 dependency
> version, like this:
>
> <!--
> <dependency>
> <groupId>org.slf4j</groupId>
> <artifactId>slf4j-api</artifactId>
> <type>jar</type>
> <version>1.6.2</version>
> </dependency>
> -->
>
> <dependency>
> <groupId>ch.qos.logback</groupId>
> <artifactId>logback-classic</artifactId>
> <type>jar</type>
> <version>0.9.9</version>
> </dependency>
>
> Now I get the following transitive dependencies:
>
> [INFO] +- ch.qos.logback:logback-classic:jar:0.9.9:compile
> [INFO] | +- ch.qos.logback:logback-core:jar:0.9.9:compile
> [INFO] | \- org.slf4j:slf4j-api:jar:1.5.0:compile
>
> This seems contradictory to what the "Baby Steps" in the user manual has
> though:
> http://logback.qos.ch/manual/introduction.html
>
> The baby steps indicate that we should be running with slf4j 1.6.2.
> Thoughts?
>
> Cheers,
> - Ole
>
>
>
> On 10/06/2011 09:11 PM, Ole Ersoy wrote:
>> Hi,
>>
>> I'm attempting to use slf4j with logback. I see the following when I
>> start tomcat:
>>
>> SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
>> SLF4J: Your binding is version 1.5.5 or earlier.
>> SLF4J: Upgrade your binding to version 1.6.x. or 2.0.x
>>
>> I'm using the following version of slf4j and logback:
>>
>> [INFO] +- org.slf4j:slf4j-api:jar:1.6.2:compile
>> [INFO] +- ch.qos.logback:logback-classic:jar:0.9.9:compile
>> [INFO] | \- ch.qos.logback:logback-core:jar:0.9.9:compile
>>
>> I also get the exception pasted at the bottom of this email. I read up
>> on it and hibernate, ran mvn dependency:tree, and looked for other slf4j
>> versions. I did not find any. I do have a dependency on JCL though. Any
>> ideas on what the problem could be?
>>
>> TIA,
>> - Ole
>>
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean with name
>> 'org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0':
>>
>> Invocation of init method failed; nested exception is
>> java.lang.NoSuchMethodError:
>> org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
>>
>>
>> at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
>>
>>


More information about the slf4j-user mailing list