Welcome! Please see the About page for a little more info on how this works.

+6 votes
in tools.logging by
closed by

Is there interest in adding a slf4j 2 factory to clojure tools.logging ?

slf4j 2 changed how it discovers implementations - now it uses java ServiceLoader (standard) facilities.

On the client side version 1.x of API is compatible with version 2.x of API.
Implementations however have changed - how the implementation is loaded.

https://www.slf4j.org/faq.html#changesInVersion200

I don't think the old way of loading is working to find new slf4j 2.0 implementations that use service loader .
https://github.com/clojure/tools.logging#selecting-a-logging-implementation (edited) .

I could provide a PR if this is of interest.

closed with the note: Nothing to change, updated test deps to 2.0.6

1 Answer

+1 vote
by

I've created a jira to track this at https://clojure.atlassian.net/browse/TLOG-28. If you're interested in providing a patch, you can follow the process to become a contributor (see https://clojure.org/dev/dev#_becoming_a_contributor ).

by
(asked on clojurians slack as well):

I checked this https://clojure.atlassian.net/browse/TLOG-28 and it seems that all that it's needed is to have the new slf4j 2.0 API on the classpath.
clojure tools-logging uses factory# (org.slf4j.LoggerFactory/getILoggerFactory) which was migrated to use ServiceLoader: https://github.com/qos-ch/slf4j/blob/a5540ad51066b4b15132fdf27ead630519541d35/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java#L107
(I don't have access to comment on the jira issue and I don't know a tools-logging specific channel ).

IMO nothing should be done for tools-logging to work with slf4j 2.0.
Clients just need to have slf4j 2.0 dependencies on the classpath.
I do recommend using 2.0 for dev profile as 1.7x will not be maintained.
by
Thanks, updated test deps and closing
...