This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-29
Channels
- # aws (2)
- # babashka (2)
- # beginners (86)
- # calva (1)
- # cider (17)
- # clojure (46)
- # clojure-conj (1)
- # clojure-nl (1)
- # clojure-uk (6)
- # clojurescript (8)
- # clojutre (2)
- # cursive (3)
- # data-science (1)
- # datascript (5)
- # datomic (1)
- # fulcro (9)
- # funcool (5)
- # jackdaw (1)
- # leiningen (6)
- # pathom (2)
- # re-frame (2)
- # rewrite-clj (2)
- # shadow-cljs (19)
- # spacemacs (12)
- # sql (2)
- # vim (26)
clojure.tools.logging
uses slf4j
if found on the classpath (as preference). I'm curious, and this may be symptomatic of clojure compiling on-the-fly (if no genclass is used), if I use the L
pattern to indicate Linenumber
in the configuration of slf4j, the linenumbers do not match the sourcecode. I suppose because of macro expansion, dynamic compliation, etc., that goes on. Would I be right? Is it useless to try and get the number output in the log when using clojure? What do others do?
@dharrigan when I tried that recently I always got the same line number in every log output line and my reading of the log4j2 docs suggested a) it would always be the line number of the actual call into the Java layer (ie., inside the logging wrapper) and b) it introduces quite an overhead to compute it anyway. So we abandoned that idea and just ensure our log calls have unique strings within any given namespace.
@seancorfield thanks for that. I've come to the same conclusion, that line numbers in this case are not useful. I've removed the encoder pattern for line numbers.
The log4j2 docs say both filename and line number can be expensive to compute. The classname is OK tho' (namespace in Clojure). Not sure if that applies to slf4j as well, but I suspect it does.