Closed barkanido closed 4 years ago
Hi @barkanido, thanks for bringing this to my attention.
(defn configure-logger [test-fn] (let [initial-config timbre/*config*] (timbre/merge-config! {:appenders {:spit {:enabled? false}}}) ;; (prn timbre/*config*) (test-fn) (timbre/set-config! initial-config)))
Please could you uncomment (prn timbre/*config*)
and post the output.
Does this problem only affect JUL messages? Are logs emitted directly from Timbre successfully silenced?
Eventually, I figured out that I do not really need timbre
nor slf4j-timbre
. Configuring JUL directly at runtime did exactly what I needed:
(defn configure-logger [test-fn]
(let [logger (Logger/getLogger "com.github.benmanes.caffeine")
initial-level (.getLevel logger)]
(.setLevel logger (Level/SEVERE))
(test-fn)
(.setLevel logger initial-level)))
(use-fixtures :each configure-logger)
Thanks for looking into that!
Hi, I have a library that wraps caffeine (which uses
java.util.logging
). And I am trying to silence the logs during tests.Added
[org.slf4j/jul-to-slf4j "1.7.30"] [com.fzakaria/slf4j-timbre "0.3.19"]
toproject.clj
under:profiles/:dev/:dependencies
and my deps are:on my tests I have added a fixture:
also, tried the same during compile time (
(timbre/merge-config! {:appenders {:spit {:enabled? false}}})
)But I can still see some logging generated as a result of the unit tests: