In Log4j latest API we have Lambda support where I can manage the Debug option easily.
Example:
logger.debug("This {} and {} with {} ", () -> this, () -> that, () -> compute());
But for slf4j/logback is there any option to have lambda enabled as mentioned above. Please let me know the syntax then.
Unfortunately, this is not supported yet: https://jira.qos.ch/browse/SLF4J-371
Version 2 of SLF4J has support for lambda syntax.
This new version also brings a fluent API. Version 2 requires Java 8 or later.
As of 2020-06, version 2 is still in the experimental/unstable phase, with the most recent alpha release being from 2019-10.
Maven POM setting:
<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>2.0.0-alpha1</version> </dependency>
See the Download page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With