Заставить slf4j использовать логбэк

Можно ли как-то заставить slf4j использовать логбек определенного провайдера ведения журналов (в моем случае )? Как и в их документах:

Multiple bindings were found on the class path

SLF4J API is desinged to bind with one and only one underlying logging framework at a time. If more than one binding is present on the class path, SLF4J will emit a warning, listing the location of those bindings. When multiple bindings are available on the class path, select one and only one binding you wish to use, and remove the other bindings. For example, if you have both slf4j->simple-1.6.6.jar and slf4j-nop-1.6.6.jar on the class path and you wish to use the nop (>no-operation) binding, then remove slf4j-simple-1.6.6.jar from the class path. If it is not possible to remove the superflous bindings, SLF4J will still bind with one logging framework/implementation. As of version 1.6.6, SLF4J will name the framework/implementation class it is actually bound to.

NOTE The warning emitted by SLF4J is just that, a warning.

В моем случае у меня есть log4j.jar, slf4j-log4j12.jar, log4j-over-slf4j.jarи все файлы журналов в пути к классам. Я знаю, что это ошибка иметь slf4j-log4j12.jarи log4j-over-slf4j.jarвместе, но мой проект очень большой, и не всегда просто найти и исключить зависимость от maven. В данном случае slf4j даже не выдал никаких предупреждений, потому что мы используем только конфиги логбэка. Мне понадобился день, чтобы понять этот баночный ад.

Все, что я хочу, это заставить slf4j использовать logback через аргумент JVM, например, чтобы он мог печатать предупреждения, и я мог исключить банки в будущем.

28
задан madhead 11 July 2012 в 13:39
поделиться