[Bug 205] New: make multiple bindings check more intelligent

http://bugzilla.slf4j.org/show_bug.cgi?id=205 Summary: make multiple bindings check more intelligent Product: SLF4J Version: 1.6.x Platform: PC OS/Version: Linux Status: NEW Severity: trivial Priority: P1 Component: Core API AssignedTo: slf4j-dev@qos.ch ReportedBy: gsubes@gmail.com I'am using SLF4J in a setup of a software product line where multiple eclipse projects (as modules) are used with their own dependency management. so every module has its own copy of the logger binding jar. the modules have references to other modules (vie eclipse project references) and thus have multiple versions of the same logger binding in the classpath when tests are run etc. This results in always receiving this warning: SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/home/subes/Dokumente/Entwicklung/invesdwin/inv-webproxy/trunk/03_module/invesdwin-gemeinsam/lib/default/logback-classic-0.9.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/subes/Dokumente/Entwicklung/invesdwin/inv-webproxy/trunk/03_module/invesdwin-gemeinsam-integration/lib/default/logback-classic-0.9.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/subes/Dokumente/Entwicklung/invesdwin/inv-webproxy/trunk/03_module/invesdwin-gemeinsam-integration-ws/lib/default/logback-classic-0.9.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/subes/Dokumente/Entwicklung/invesdwin/inv-webproxy/trunk/03_module/invesdwin-gemeinsam-webserver/lib/default/logback-classic-0.9.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. -------------------------------- It would be nice if slf4j would check if the bindings actually have the same name and then ignore multiple jars of the same binding. the warning is made without a real reason in this particular case and should be more intelligent to allow such use cases. Or at least give me a hint on how to disable this warning on my own account. :) -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=205 Selvakumar Esra <selvakumar.esra@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |selvakumar.esra@gmail.com --- Comment #1 from Selvakumar Esra <selvakumar.esra@gmail.com> 2010-12-14 05:52:28 --- i'm also facing the same issue. i am working on a module which is a child module for a bigger parent module. The parent module uses SLF4J simple binding.(to redirect logs to console). i want to log to both console as well as file. so i was using SLF4J - log4j12 binding. Both bindings cant be placed in the classpath for SLF4J.(gives warning and always logs to console). i dont have permission to exclude the slf4j-simple jar from the parent module. it would be nice if i am given option to choose the binding through some configuration file/constants (-Dslf4j.configuration.binding=log4j). -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=205 --- Comment #2 from subes <gsubes@gmail.com> 2011-05-13 20:48:16 CEST --- nevermind, I fixed this in the meantime by changing the setup of my eclipse project classpath generator. now projects reference the same file (via transitive dependencies), so eclipse only loads the lib once for the classpath. example: projectA/ - lib/ - slf4j.jar eclipse-build-path: lib/slf4j.jar projectB/ - lib/ - slf4j.jar (ignored in cp) eclipse-build-path: /projectA, /projectA/lib/slf4j.jar thus projectB which has a dependency on projectA loads slf4j.jar from projectA directly. -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=205 Tonio <tonioc@exeo.com.ar> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tonioc@exeo.com.ar --- Comment #3 from Tonio <tonioc@exeo.com.ar> 2012-10-25 22:45:27 CEST --- Interesting thing I'm facing about this report, I'm dealing with isolated class loader (ChildFirst) lookup and I'm facing a warning that I think should not be a warning at all SystemClassLoader +------- logback + slf4 api | + ChildFirstClassLoader +----------- simple + slf4 api +----------- MyClass.java When LoggerFactory is called inside MyClass.java a warning message telling me that 2 bindings are available (ClassLoader.getResources(name) call): 1 - from logback 2 - from simple But of course when slf4j API instantiates StaticLoggerBinder.getSingleton(), the ChildFirstClassLoader will load simple's implementation, which in fact is the unique implementation available for MyClass.java because logback is hidden by the ChildFirstClassLoader. Just thinking out loud: Could it be possible to identify what classLoader is used to load the resource (really not sure if this is possible), and do not warn if there is a single binding available for the current API ? Hope this is useful somehow, thanks tonio -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=205 manmadha <manmad.bhumireddy@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |manmad.bhumireddy@gmail.com -- You are receiving this mail because: You are the assignee for the bug.
participants (2)
-
bugzilla-daemon@pixie.qos.ch
-
bugzilla-daemon@qos.ch