rgoers opened a new issue, #1813: URL: https://github.com/apache/logging-log4j2/issues/1813
## Description See https://jira.qos.ch/browse/SLF4J-600. It seems SLF4J added an addKeyValue method to its fluent API. When this is called the data is not being added to a MapMessage as it needs to be. ## Configuration **Version:** 2.20.0 ## Logs When SLF4J routes to Log4j the output looks like: ``` [19.09.2023 19:25:51,248] [INFO ] - slf4j2-with-log4j - Measure times: ``` None of the key/value pairs are present. ## Reproduction The code has ``` private static final Logger LOG = LoggerFactory.getLogger("PERFORMANCE"); ... LOG.atInfo().setMessage("slf4j2-with-log4j - Measure times:") .addKeyValue("myDocId", documentId) .addKeyValue("myInitExtractorInMs", createFormExtractor) .addKeyValue("myvalidatedDocumentInMs", validatedDocument) .addKeyValue("myreadPageInMs", readPage) .addKeyValue("mytransformInfosInMs", transformInfos) .log(); ``` To work properly this needs to translate into ``` StringMapMessage log4jMap = new StringMapMessage() .with("message", "direct log4j implementation - Measure times:") .with("myDocId", documentId) .with("myInitExtractorInMs", createFormExtractor) .with("myvalidatedDocumentInMs", validatedDocument) .with("myreadPageInMs", readPage) .with("mytransformInfosInMs", transformInfos); LogManager.getLogger("PERFORMANCE").info(log4jMap); ``` Note that IMO it would be better for Log4j's LogBuilder add support for addKeyValue and internally populate a MapMessage. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
