[slf4j-dev] [JIRA] Updates for SLF4J-511: DefaultLogEventBuilder causes incorrect location information to be logged

QOS.CH (JIRA) noreply-jira at qos.ch
Mon Mar 22 07:23:00 CET 2021


SLF4J / SLF4J-511 [Open]
DefaultLogEventBuilder causes incorrect location information to be logged

==============================

Here's what changed in this issue in the last few minutes.
This issue has been created
This issue is now assigned to you.

View or comment on issue using this link
https://jira.qos.ch/browse/SLF4J-511

==============================
 Issue created
------------------------------

Ralph Goers created this issue on 22/Mar/21 7:08 AM
Summary:              DefaultLogEventBuilder causes incorrect location information to be logged
Issue Type:           Bug
Affects Versions:     2.0.0-alpha1
Assignee:             SLF4J developers list
Components:           Core API
Created:              22/Mar/21 7:08 AM
Environment:
  SeeĀ [LOG4J2-2975|https://issues.apache.org/jira/browse/LOG4J2-2975]. DefaultLogEventBuilder does
  
  
  {code:java}
  	private void innerLog(LoggingEvent logggingEvent) {
  		if (logger instanceof LoggingEventAware) {
  			((LoggingEventAware) logger).log(logggingEvent);
  		} else {
  			logViaPublicLoggerAPI(logggingEvent);
  		}
  	}
  {code}
  
  In both alternatives DefaultLogEventBuilder is going to show up as the caller of the logging API since there is no provision made to allow the implementation to determine the caller of the log method in DefaultEventBuilder.  
  
  As such, for all practical purposes this class is useless.  This issue does not affect Logback since it is using the NOPLoggingEventBuilder so the fluent API doesn't work in Logback at all. If it were using DefaultLogEventBuilder it would suffer from the same problem.
  
  The workaround is that any implementation that wants to support SLF4J's fluent API must implement its own LogEventBuilder.
Priority:             Major
Reporter:             Ralph Goers


==============================
 This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59)



More information about the slf4j-dev mailing list