This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-08
Channels
- # announcements (5)
- # aws (15)
- # babashka (7)
- # beginners (138)
- # bristol-clojurians (2)
- # chlorine-clover (11)
- # cider (9)
- # clara (4)
- # clj-kondo (17)
- # cljsrn (20)
- # clojars (1)
- # clojure (73)
- # clojure-europe (17)
- # clojure-italy (1)
- # clojure-nl (9)
- # clojure-spec (4)
- # clojure-uk (9)
- # clojurescript (43)
- # data-science (1)
- # datomic (87)
- # emacs (2)
- # figwheel-main (30)
- # fulcro (71)
- # helix (2)
- # hugsql (4)
- # jackdaw (5)
- # jobs (3)
- # jobs-discuss (31)
- # juxt (5)
- # kaocha (6)
- # lein-figwheel (16)
- # leiningen (1)
- # luminus (4)
- # malli (2)
- # meander (54)
- # music (8)
- # nrepl (12)
- # observability (28)
- # off-topic (85)
- # pathom (11)
- # re-frame (99)
- # reitit (9)
- # ring (1)
- # rum (6)
- # sci (11)
- # shadow-cljs (102)
- # sql (22)
- # tools-deps (10)
- # vim (65)
- # xtdb (14)
Finally had a chance to setup log4j2 based on recommendations from this channel. It works great! My question is around what needs to be excluded (if anything). For example, I followed https://gist.github.com/ataggart/ac208c289c5d01dacf3b4b341a1c37f0 + Sean’s suggestions. Now, TMK the exclusions from the gist, because i’m using deps.edn
, don’t happen globally but at the individual dep level. So, how can I figure out which dep I need to add the excludes to? Do I even need to exclude anything?
if you do want to check if something is being loaded that shouldn't then clj -Stree
is your friend
So, just to confirm I understand, we would just run clj -Stree
and if any of the deps specified in https://lambdaisland.com/blog/2020-06-12-logging-in-clojure-making-sense-of-the-mess (as an example) appear as a dep of one of my logging library, those might be good candidates to exclude?
As an example, I can run clj -Stree
right now and I get something like
; ...
org.apache.logging.log4j/log4j-jcl 2.13.0
commons-logging/commons-logging 1.2
; ...
Perhaps I would exclude commons-logging/commons-logging
from org.apache.logging.log4j/log4j-jcl
.If you have all the log4j2 bridges as top-level dependencies, I don't think it matters if anything else brings them in as transitive dependencies?
I don't exclude other logging implementations and I haven't seen any problems (and we depend on a ton of stuff that drags in other logging implementations, I'm sure... but let me check).
Hmm, apparently less than I thought.
org.clojure/tools.logging 1.1.0
commons-logging/commons-logging 1.1.1
The rest is all org.apache.logging.log4j
stuff (which is log4j2)(we do not exclude commons logging from tools.logging)
@ataggart That was what @tkjone linked to about half an hour ago that started this discussion 🙂
I've never needed to exclude other logging dependencies -- do you know when that is needed?
(given that deps.edn
doesn't have global exclusions)
I can see it might matter with Leiningen/Boot because of Aether.
So... maybe I'm just lucky I've never been bitten by it...?
heh, so maybe the take away is that based on my current set of dependencies I am using + the fact that lein
+ tools.deps
have a different process for resolving deps, I am good to avoid exclusions for now (because they are not appearing as transitive deps from what I can see).
However, should I add new deps, it would be good to check if any exclusions need to be made
Here's all we have at work
;; use log4j 2.x:
org.apache.logging.log4j/log4j-api {:mvn/version "2.13.3"}
;; bridge into log4j:
org.apache.logging.log4j/log4j-1.2-api {:mvn/version "2.13.3"}
org.apache.logging.log4j/log4j-jcl {:mvn/version "2.13.3"}
org.apache.logging.log4j/log4j-jul {:mvn/version "2.13.3"}
org.apache.logging.log4j/log4j-slf4j-impl {:mvn/version "2.13.3"}
We don't even have log4j-core
(and no exclusions)
Looks like the bridges bring in core anyway:
org.apache.logging.log4j/log4j-slf4j-impl 2.13.3
org.apache.logging.log4j/log4j-core 2.13.3
from -Stree
Thanks all!