[slf4j-user] explicitly selecting an implementation

Jakub Suder kuba at hivewallet.com
Mon Jun 23 17:21:29 CEST 2014


Hi,

I’m building an OSX application which includes a Java library that uses SLF4J. I’ve added my own simple logging implementation that redirects all logs to the native Cocoa code, by providing a StaticLoggerBinder (implements LoggerFactoryBinder) which creates a CocoaLoggerFactory which in turn creates a CocoaLogger.

Everything is fine so far, except it turns out that some users have some unrelated Java software installed in their system that is added to Extensions directory, which causes it to be included by default in all Java apps. If they happen to have a different SLF4J implementation included there, it gets included before my own implementation, which causes an exception in the logging code and crashes my app.

Is there any way to force SLF4J to use my own implementation explicitly, either through configuration or through code, and ignore the others that can be included at runtime? (I’ve tried to exclude the extension directories from the load path, but this in turn causes different problems because sometimes essential jars needed for various crypto functionality are included there, so I want to stop messing with that…)

Kuba



More information about the slf4j-user mailing list