[slf4j-dev] [JIRA] Updates for SLF4J-560: Clarify Logger.makeLoggingEventBuilder() method semantics
QOS.CH (JIRA)
noreply-jira at qos.ch
Wed Sep 14 18:13:00 CEST 2022
SLF4J / SLF4J-560 [Resolved]
Clarify Logger.makeLoggingEventBuilder() method semantics
==============================
Here's what changed in this issue in the last few minutes.
There are 2 comments.
View or comment on issue using this link
https://jira.qos.ch/browse/SLF4J-560
==============================
2 comments
------------------------------
Piotr P. Karwasz on 14/Sep/22 6:00 PM
[~ceki],
I don't see any advantage in returning a real builder, since the level of the builder can not be modified.
Besides that the {{log4j-slf4j2-impl}} implementation currently implements {{makeLoggingEventBuilder}} as a wrapper around the Log4j2 [Logger.atLevel|https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/Logger.html#atLevel-org.apache.logging.log4j.Level-] method. If we remove the level check we'll end up with a wrapper around a NOOP {{LogBuilder}} instead of a NOOP {{LoggingEventBuilder}}, which is slightly less effective.
------------------------------
Ceki Gülcü on 14/Sep/22 6:03 PM
Indeed, the {{makeLoggingEventBuilder}} is a constructor for the {{LoggingEventBuilder}} type appropriate for the implementation. The behavior is documented in the [javadocs|https://www.slf4j.org/apidocs/org/slf4j/Logger.html#atLevel-org.slf4j.event.Level-].
The log4j implementation in log4j-slf4j2 does not suffer from double checks since you override the {{atXYZ}} methods in {{org.apache.logging.slf4j.Log4jLogger}}. You could delegate to the default implementation in org.slf4j.Logger if you implement {{makeLoggingEventBuilder}} by returning an instance of {{Log4jEventBuilder}}.
==============================
This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59)
More information about the slf4j-dev
mailing list