[slf4j-dev] [JIRA] Updates for SLF4J-371: Support the lambda expression in the Logger

QOS.CH (JIRA) noreply-jira at qos.ch
Mon Dec 27 19:19:00 CET 2021


SLF4J / SLF4J-371 [Resolved]
Support the lambda expression in the Logger

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

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-371

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

Oleksandr Gavenko on 27/Dec/21 7:05 PM
I saw similar approach in https://github.com/logfellow/logstash-logback-encoder for `logger.debug("Lazy logging {}", () -> "called");`.

They introduced special type they detect to support structured logging in Logback without waiting for v1.3.0 to become stable:

https://github.com/logfellow/logstash-logback-encoder/blob/main/src/main/java/net/logstash/logback/argument/StructuredArguments.java

like `logger.info("log message {}", keyValue("name", "value"));` 

With lambda & Supplier it is almost the same except we miss the name. `StructuredArguments` is known only to `logstash-logback-encoder` though.


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



More information about the slf4j-dev mailing list