Yet another logger API in Java with beautiful features
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Yet another logger API in Java with beautiful features

beautiful_logger is a mostly-zero-overhead wrapper on top of the existing logging implementations with a familiar API (info, error, etc) that let you configure/re-configure the logger dynamically in a programmatic way.

This library requires at least Java 8 at runtime and is fully compatible with Java 9 modules.

This library requires Java 11 to build.

The javadoc of the latest version is available online.


  • real zero cost (no allocation, no branch, no assembly code) if a logger is disabled
  • zero overhead cost when delegating to the logging libraries you already use, SLF4J, Log4J, Logback, JUL or SystemLogger JEP 264.
  • allow user defined Log services to higher up your logging practice
  • dynamic configuration/re-configuration which doesn't use costly inter-thread signaling
  • no configuration file, no XML, etc, everything is done programmatically
  • very small modular jar with no dependency

Why another logging API ?

Technically it's more a facade like SLF4J, anyway, beautiful_logger exists because no other existing logging libraries provide at least one of features listed above.

Why do you claim that there is no overhead ?

The implementation of this API ensures that the JIT can fully inline any calls to the Logger API without decrementing your inlining budget. This is similar to the way, MethodHandle or VarHandle are optimized in the JDK. The main drawback is that it put more pressure to the JITs so it may lengthen the time to steady state of an application.


import com.github.forax.beautifullogger.Logger;

class Example {
  // getLogger with no argument uses the current class as configuration class
  private static final Logger LOGGER = Logger.getLogger();
  public static void main(String[] args) {
    for(int i = 0; i < 10; i++) {
      // use a lambda that does not capture any parameters 
      LOGGER.error((int value) -> "message " + value, i);
      if (i == 1) {
        // disable the logger programmatically
        LoggerConfig.fromClass(Example.class).update(opt -> opt.enable(false));

Build Tool Integration

Get latest binary distribution via JitPack




repositories {
    maven { url '' }
dependencies {
    compile 'com.github.forax:beautiful_logger:master-SNAPSHOT'