slf4j-gelf provides the capability of creating GELF-formatted log messages via SLF4J.
slf4j-gelf requires Java 11.
Maven:
<dependency>
<groupId>com.github.fbrandes</groupId>
<artifactId>slf4j-gelf</artifactId>
<version>0.0.1</version>
</dependency>
Gradle:
dependencies {
implementation("com.github.fbrandes:slf4j-gelf:0.0.1")
}
With slf4j-gelf loggers can be created similar to SLF4J but instead of LoggerFactory
there is GelfLoggerFactory
.
private static final Logger LOGGER = new GelfLoggerFactory().getLogger(Log4jTest.class);
LOGGER.info("foo");