You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to request that the org.apache.logging.slf4j.Log4jMarker class be made public once again, as it was prior to version 2.19.0.
Having markers in the LogEvent is a powerful mechanism for passing custom markers with custom fields inside. Previously, it was possible to implement a custom marker and pass it through the log4j logger as a Log4jMarker, which could then be caught in a custom FieldProvider, analyzed, and acted upon.
However, with the release of version 2.19.0, this functionality was removed by making the Log4jMarker class package-private. As a result, all custom markers are converted into Log4jMarker inside the Log4jMarkerFactory, and only the name and parents fields are retained, which is unacceptable for our use case.
Therefore, I request that the Log4jMarker class be made public once again, in order to allow for the same level of flexibility and customization that was available prior to version 2.19.0. Additionally, I would like to note that the Log4jMarker constructor remains public, so making the class itself public should not pose any security concerns.
Thank you for your consideration.
The text was updated successfully, but these errors were encountered:
ppkarwasz
added
bug
Incorrect, unexpected, or unintended behavior of existing code
api
Affects the public API
labels
Apr 7, 2023
Even though I don't agree with the way you use Log4jMarker, we should indeed not break the backward compatibility. Hence, I have fixed the issue. (Had a talk with @ppkarwasz and he will drop our further remarks here.)
All in all, feedback is feedback. Thanks for sharing the issue with us. 🙇
The API breakage in 2.19.0 was unintentional and we'll revert it in the 2.x branch. As for the 3.x branch I would keep the class hidden.
The reasons behind this are largely explained in #770: using markers to convey additional data is IMHO a hack to workaround SLF4J's limitations. Unlike the Log4j API that allows to log any kind of Message, for a very long time SLF4J only allowed to log Strings (or the equivalent of ParameterizeMessage).
The situation changed with the release of SLF4J 2.x:
Hello,
I would like to request that the
org.apache.logging.slf4j.Log4jMarker
class be madepublic
once again, as it was prior to version2.19.0
.Having markers in the
LogEvent
is a powerful mechanism for passing custom markers with custom fields inside. Previously, it was possible to implement a custom marker and pass it through thelog4j
logger as aLog4jMarker
, which could then be caught in a customFieldProvider
, analyzed, and acted upon.However, with the release of version
2.19.0
, this functionality was removed by making theLog4jMarker
classpackage-private
. As a result, all custom markers are converted intoLog4jMarker
inside theLog4jMarkerFactory
, and only the name and parents fields are retained, which is unacceptable for our use case.Therefore, I request that the
Log4jMarker
class be made public once again, in order to allow for the same level of flexibility and customization that was available prior to version2.19.0
. Additionally, I would like to note that theLog4jMarker
constructor remainspublic
, so making the class itselfpublic
should not pose any security concerns.Thank you for your consideration.
The text was updated successfully, but these errors were encountered: