Fork me on GitHub

Good Morning!

dharrigan08:09:46 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.


indeed! 🙂