elf4j-tinylog

Maven Central

elf4j-tinylog

An adapter to use tinylog as service provider and runtime log engine for the ELF4J (Easy Logging Facade for Java) API

User story

As an application developer using the ELF4J API, I want to have the option of selecting tinylog as my log engine, at application deploy time without code change or re-compile.

Prerequisite

Java 8+

Get it…

Maven Central

In Maven or other build tools alike, install ELF4J API as compile-scope dependency; and this provider as runtime-scope dependency.

Use it…

If you are using the ELF4J API for logging, and wish to select or change to use tinylog as the run-time log engine, then simply pack this binding JAR in the classpath when the application deploys. No code change needed. At compile time, the client code is unaware of this run-time logging service provider. With the ELF4J facade, opting for tinylog as the logging implementation is a deployment-time decision.


<dependency>
    <groupId>io.github.elf4j</groupId>
    <artifactId>elf4j</artifactId>
    <scope>compile</scope>
</dependency>

<dependency>
    <groupId>io.github.elf4j</groupId>
    <artifactId>elf4j-tinylog</artifactId>
    <scope>runtime</scope>
</dependency>

The usual tinylog configuration applies.

Note: Only one logging provider such as this should be in effect at run-time. If multiple providers end up in the final build of an application, somehow, then the elf4j.service.provider.fqcn system property will have to be used to select the desired provider. For example,

java -Delf4j.service.provider.fqcn="elf4j.tinylog.TinylogLoggerFactory" -jar MyApplication.jar