-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Noisy Netty logs show up after adopting this library #32
Comments
Just tried |
Thanks for the thorough report! This looks similar to #21 (comment) Strange that none of those things you tried worked. I assumed they would resolve this but I never actually checked at the time |
I think This should cause our tests to fail but it doesn't:
|
Good that you post that, I was about to create a new issue (which would need a separate repo/repro): logs that are successfully re-routed via slf4j-timbre are unconditionally logged, i.e. For proof I added
|
It looks like Timbre's compile-time elision is not working with slf4j-timbre. This is because:
Unfortunately this project requires AOT. I will try to find another solution. |
So when
|
Any progress on this? I figure an improvement would at least be to set the AOT compiled default level to info? |
It should be possible to filter out Jetty (and other noisy libraries) using the One of my projects has the following in an {:ns-blacklist ["com.zaxxer.hikari.pool.*"
"io.netty.*"
"org.apache.http.*"
"org.eclipse.jgit.util.FS"]} Seems to work fine. It's quite heavy handed, but that particular blacklist is used only for some configurations -- it's probably not something that should be enabled globally... |
My problem is that loads of logging happen during execution of tools.deps plugins such as deps-ancient and pack.alpha where I do not have the option to set anything at runtime. |
Ah, gotcha. Then I'm not of much use, sorry. I'm not even sure how I'd go about it... Hope you find a solution! |
Thanks -- and thanks for trying to help! I'm not very ventured in slf4j-implementation land, but I figure that it would be possible to set the default timbre log level to Personally when binding slf4j I would like the default level to be :info. |
I updated factory.clj to be: (ns slf4j-timbre.factory
(:gen-class
:name com.github.fzakaria.slf4j.timbre.TimbreLoggerFactory
:implements [org.slf4j.ILoggerFactory]
:state state
:init init)
(:require slf4j-timbre.adapter
[taoensso.timbre :as timbre])
(:import
(com.github.fzakaria.slf4j.timbre TimbreLoggerFactory TimbreLoggerAdapter)))
(defonce bootstrapped (atom false))
(defn -init
[]
(when-not @bootstrapped
(reset! bootstrapped true)
(let [lvl (System/getProperty "TIMBRE_LEVEL" ":info")]
(timbre/set-level! (keyword (subs lvl 1)))))
[[] (atom {})]) This seems to work fine for me. I will make a pull request. |
That seems like a good compromise IMO, but I'd make sure it was possible to override the default log level easily. That way it'd avoid the worst of too verbose logs, and users that want to see everything can adjust it to their needs. |
…efore timbre end user has had the chance to configure log level. Ref issue fzakaria#32
Thanks for the input @runejuhl. I've added a pull request now which respects TIMBRE_LEVEL and defaults to The reason for defaulting to Thanks for the library @rufoa and hope you have time to review the pull request. |
Finally (sorry!) resolved in version Big thanks to everyone who helped sort this out |
Hi there,
this library works as intended. Kudos!
However I noticed this relatively minor nuisance at startup (e.g.
lein repl
):...those lines didn't show up before
slf4j-timbre
adoption. From what I can see, Netty has the following static code which will run merely by being imported: https://github.com/netty/netty/blob/6464c98743779778e52db59522f269bfe47a46af/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L92So, in the average project that uses both Netty and Timbre, it's much more likely that Netty will be imported before Timbre is setup, which would be the place to silence this annoyance.
Is this a known scenario?
I tried solving it with
:jvm-opts ["-Dorg.slf4j.simpleLogger.defaultLogLevel=WARN"]
, no luck. Another one was(-> (Logger/getLogger "io.netty.util.internal.PlatformDependent") (.setLevel Level/OFF))
in user.clj.Thanks - Victor
The text was updated successfully, but these errors were encountered: