Skip to content
Switch branches/tags

Semantic Logger

Build Status Java: Maven Central (Java) Kotlin: Maven Central (Kotlin)

This little library is inspired by the talk Observability in einer Microservice Welt held on Berlin Expert Days 2018 by Andreas Weigel and Jakob Fels.

If you prefer to have some semantic to your logging and improve code readability you can use the SemanticLogger and its SemanticLoggerFactory which adds a thin layer around Slf4j.

The SemanticLoggerFactory can be used like the Slf4j LoggerFactory to create a new Logger by class, name or a delegateLogger:

SemanticLogger logger = SemanticLogger. getLogger(SomeClass.class);

SemanticLogger logger = SemanticLogger. getLogger("SomeLoggerName");

Logger delegateLogger = org.slf4j.LoggerFactory.getLogger(SomeClass.class);
SemanticLogger logger = SemanticLogger. getLogger(delegateLogger);

The SemanticLogger itself provides the following methods for logging:

SemanticLogger log = SemanticLoggerFactory.getLogger(MyClass.class);
log.forTestPurpose(...);                // will log a debug event
log.asExpectedByDefault(...);           // will log an info event
log.toInvestigateTomorrow(...);         // will log a warn event
log.wakeMeUpInTheMiddleOfTheNight(...); // will log an error event


Export the secret keys to a keyring:

gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg
 ./gradlew --console=plain -PrepositoryUser=<user> -PrepositoryPassword="<password>" -PsigningKeyId=0x12345678 -PsigningPassword="<key_password>" -PsigningSecretKeyRingFile="/path/to/secring.gpg"


Add semantic logging to your JVM project when using SLF4J.




No packages published