SLF4JServiceProvider cannot be found #295
-
Good evening everyone! As code reference I have pasted everything on pastebin: Thank you for any help in advance - Have a great day! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Have you placed a provider-configuration file in the resource directory META-INF/services? That is, have you added a META-INF/services/org.slf4j.spi.SLF4JServiceProvider file containing the fully qualified class name of your provider? See also https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html |
Beta Was this translation helpful? Give feedback.
-
Hi, the ServiceLoader stuff is not described anywhere in the FAQ under How do I make my logging framework SLF4J compatible? . It tells you to use slf4j-jdk14 as a reference for how to implement a binding for your logging backend. But as far as I can tell, org.slf4j.spi.SLF4JServiceProvider which it inherits from does not exist. Can you please point me to up-to-date documentation on how to implement a logger backend? If none exists, I'd like to request that the manual / FAQ is updated. |
Beta Was this translation helpful? Give feedback.
-
If you are stuck with a compile time dependency against older slf4j versions, eg. a spring 5.x / spring boot combo (eg. https://github.com/spring-projects/spring-boot/blob/2.7.x/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java#L293) or similar, you could run a simple adapter like this:
It's not pretty, but you can upgrade slf4j and keep rolling... |
Beta Was this translation helpful? Give feedback.
-
@EricHeath-AI Now that that is tricky 👍 The other way with spring boot is to just disable their logging which is documented in the following spring-projects/spring-boot#12649 and there are a couple of extra options in how to achieve that now too. Kind of feel like above would be a smoother solution. |
Beta Was this translation helpful? Give feedback.
Have you placed a provider-configuration file in the resource directory META-INF/services? That is, have you added a META-INF/services/org.slf4j.spi.SLF4JServiceProvider file containing the fully qualified class name of your provider?
See also https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html