[slf4j-dev] [JIRA] Updates for SLF4J-531: MDC should support stack values identified by key

QOS.CH (JIRA) noreply-jira at qos.ch
Thu Apr 14 00:47:00 CEST 2022


SLF4J / SLF4J-531 [Open]
MDC should support stack values identified by key

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

Here's what changed in this issue in the last few minutes.

There is 1 comment.

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

==============================
 1 comment
------------------------------

Piotr P. Karwasz on 14/Apr/22 12:32 AM
[~ceki],

Log4j 2.x has a single stack of strings available, therefore all the remaining keyed stacks need to be stored as strings. I submitted a functional implementation for Log4j2 as [PR #820|https://github.com/apache/logging-log4j2/pull/820], but I can be easily adapt it as an SLF4J default method implementation.

The key assumption (no pun intended) in that proposal is that users should not use the same keys for their string and stack values, which is not a heavy restriction and can be added to the {{MDCAdapter}} contract.

I am not sure how many active logging frameworks are still there, but JBoss Log Manager would probably also prefer to share the key namespace between string and stack values (cf. [MDC|https://github.com/jboss-logging/jboss-logmanager/blob/main/core/src/main/java/org/jboss/logmanager/MDC.java]).

Since most users will probably use a single stack of strings, I might also suggest to add to the interface some methods without a {{key}} parameter that would use default key of the SLF4J implementation (the NDC for Log4j2 and JBoss Log Manager).

 


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



More information about the slf4j-dev mailing list