qos-ch / logback

The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
Other
3.02k stars 1.28k forks source link

TurboFilters should be called with format/params/throwable when using fluent logging API #871

Open christophejan opened 3 weeks ago

christophejan commented 3 weeks ago

I think TurboFilter decide method should be called with provided format/params/throwable the same way whether fluent logging API has been used or not.

Currently, with slf4j-api 2.0.16 and logback-classic 1.5.8 :

In logback documentation, I found :

I think it’s an issue that TurboFilters is not called with format/params/throwable when using fluent logging API.

jakobleck commented 9 hours ago

+1 I had an issue trying to filter logs using a TurboFilter based on matching the format with a specific string and returning a DENY, but in the resulting logs in the console the string still appeared, presumably from calls to decide with format = null. Adding a

    if (format == null) {
      return FilterReply.DENY;
    }

to the decide fixed it, but doesn't look that good to me... (Or is it?)

At the very least, I think, it should be documented that TurboFilter's decide can be called with null parameters.