You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "AlexxeyKa (via GitHub)" <gi...@apache.org> on 2023/04/07 11:15:07 UTC

[I] Restore the public access level of the Log4jMarker class to its pre-2.19.0 state (logging-log4j2)

AlexxeyKa opened a new issue, #1414:
URL: https://github.com/apache/logging-log4j2/issues/1414

   Hello,
   
   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Restore the public access level of the Log4jMarker class to its pre-2.19.0 state (logging-log4j2)

Posted by "vy (via GitHub)" <gi...@apache.org>.
vy closed issue #1414: Restore the public access level of the Log4jMarker class to its pre-2.19.0 state
URL: https://github.com/apache/logging-log4j2/issues/1414


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Restore the public access level of the Log4jMarker class to its pre-2.19.0 state (logging-log4j2)

Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on issue #1414:
URL: https://github.com/apache/logging-log4j2/issues/1414#issuecomment-1748852847

   @AlexxeyKa,
   
   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`](https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/message/Message.html), for a very long time SLF4J only allowed to log `String`s (or the equivalent of [`ParameterizeMessage`](https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/message/ParameterizedMessage.html)).
   
   The situation changed with the release of SLF4J 2.x:
    * using [`LoggingEventBuilder#addKeyValue`](https://www.slf4j.org/api/org/slf4j/spi/LoggingEventBuilder.html#addKeyValue-java.lang.String-java.lang.Object-) you can attach any kind of additional data to the logging event.
    
    As discussed in #1813 the bridges between SLF4J and Log4j API will (probably) map [`KeyValuePair`](https://www.slf4j.org/api/org/slf4j/event/KeyValuePair.html)s to entries in a [`MapMessage`](https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/message/MapMessage.html) and viceversa.
    
    @rgoers, am I missing something?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Restore the public access level of the Log4jMarker class to its pre-2.19.0 state (logging-log4j2)

Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on issue #1414:
URL: https://github.com/apache/logging-log4j2/issues/1414#issuecomment-1748834350

   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. :bow:


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org