[logback-user] Spring -> SLF4J -> Logback

David Roussel nabble at diroussel.xsmail.com
Mon Apr 11 10:03:06 CEST 2011


Luciano,

The problem is probably because you have commons-logging the class path. 
Use the maven dependencies plugin to find where it is coming from.  It'll
definately be coming from spring, but possibly other places.

Then try this:


			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-core</artifactId>
				<version>${spring-version}</version>
				<exclusions>
					<exclusion>
						<groupId>commons-logging</groupId>
						<artifactId>commons-logging</artifactId>
					</exclusion>					
				</exclusions>
			</dependency>

David


Luciano Santos-2 wrote:
> 
> Hello.
> 
>   I am trying to integrate Logback for the first time in a project of
> mine, and i'm having such a hard time trying to use it along with
> Spring 3.0.5.
> I declared jcl-over-slf4j dependency so it replaces commons-logging
> used by spring-core, but it seems like something is missing or wrong:
> 
> java.lang.NoSuchMethodError:
> org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
> 	at
> org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)
> 	at
> org.springframework.jca.context.SpringContextResourceAdapter.start(SpringContextResourceAdapter.java:151)
> ...
> 
> Here're my logging dependencies (No commons-logging or log4j are being
> used):
> 		<dependency>
> 			<groupId>ch.qos.logback</groupId>
> 			<artifactId>logback-core</artifactId>
> 			<version>0.9.28</version>
> 			<type>jar</type>
> 			<scope>runtime</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>ch.qos.logback</groupId>
> 			<artifactId>logback-classic</artifactId>
> 			<version>0.9.28</version>
> 			<type>jar</type>
> 			<scope>runtime</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.slf4j</groupId>
> 			<artifactId>slf4j-api</artifactId>
> 			<version>1.6.1</version>
> 			<type>jar</type>
> 			<scope>runtime</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.slf4j</groupId>
> 			<artifactId>jcl-over-slf4j</artifactId>
> 			<version>1.6.1</version>
> 			<type>jar</type>
> 			<scope>runtime</scope>
> 		</dependency>
> 
> Any thoughts about what may be wrong?
> 
> Thank you
> 
> Luciano
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
> 
> 

-- 
View this message in context: http://old.nabble.com/Spring--%3E-SLF4J--%3E-Logback-tp31206141p31368052.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list