fzakaria / slf4j-timbre

SLF4J binding for Clojure's Timbre
Eclipse Public License 1.0
94 stars 24 forks source link

Default log level does not match default timbre log level #47

Open johnbendi opened 2 years ago

johnbendi commented 2 years ago

The code here clearly shows this: https://github.com/fzakaria/slf4j-timbre/blob/b077afc957783ffae56b73b252203b2410d504d1/src/slf4j_timbre/factory.clj#L12-L22 This caused me a lot of problem and valuable time trying to understand why the default setup was not logging at :debug level which is the advertised default for timbre

pfernandez commented 2 years ago

Glad I saw this issue, I don't see TIMBRE_LEVEL anywhere in the timbre docs and was finally able to change the level with export TIMBRE_LEVEL=':warn'.

rufoa commented 2 years ago

I implemented this in https://github.com/fzakaria/slf4j-timbre/pull/36#issuecomment-562430641 because people had the opposite problem: they started using slf4j-timbre and suddenly the old slf4j default level of info was effectively lowered to debug (timbre's default).

When using libraries like netty, this caused a ton of debug messages to be spewed out before the user could even configure timbre's log level or filtering to shut them up - a problem they didn't have until they started using slf4j-timbre.

We aimed to minimise surprises like this by setting the default level for slf4j-emitted messages to slf4j's default (info), while also not altering the default level for timbre-emitted messages (debug), until the user explicitly configures which level and filters they want. And then we start following that.

So the solution is to explicitly configure timbre's levels in one of the ways they provide (env var, with-level, set-config!, etc etc).

But I recognise this behaviour has caused you both frustration, so I will make sure to document this more prominently in case other people are also running timbre without an explicit config.

pfernandez commented 2 years ago

Thank you, I think a little extra documentation would be helpful. Also note that LOG_LEVEL is legacy and undocumented in timbre, which now uses TAOENSSO_TIMBRE_MIN_LEVEL_EDN instead.

ptaoussanis commented 2 months ago

Hi folks - in case this is still relevant for you, you might want to try Timbre v6.6.0-RC1 which now includes built-in SLF4J(v2) support.