[slf4j-user] Question regarding slf4j and 3rd parties libraries
Ceki Gulcu
ceki at qos.ch
Tue May 25 14:57:42 CEST 2010
Hello Olivier,
You have not specified the desired target for logging output. Anyway,
you should know that there are two distinct concepts in SLF4J, binding
and bridge. An SLF4J bridge redirects code *generated* by
commons-logging, log4j or j.u.l. *to* SLF4J whereas a binding
instructs SLF4J to send logging events made using the SLF4J API to an
underlying logging framework implementation such as log4j, j.u.l. or
logback.
Joern also provided an example of how commons-logging could be
replaced by jcl-over-slf4j, a bridge in SLF4J terminology. If you are
using Maven, instead of using exclusions, commons-logging can be
overriden by setting it the provided scope, e.g.
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.6.0</version>
</dependency>
See also http://slf4j.org/faq.html#excludingJCL
He also showed how calls to log4j could be intercepted by
log4j-over-slf4j (also a bridge) and directed to SLF4J.
Let us know if you need further information,
On 25.05.2010 10:53, Olivier Bourdon wrote:
> Hello everyone
>
> let's assume that my Java code is using several different 3rd parties
> libraries (Hibernate, Jersey and some others) which
> use "potentially unknown" logging mechanisms (java standard logging or
> log4j). How will slf4j behave in this case as
> I know I can not use more than 1 binding ? Do I need any special
> configuration file settings ?
>
> Thanks for your time & help
>
> Best regards
> Olivier Bourdon
More information about the slf4j-user
mailing list