adam bien's blog

System.Logger--the minimalistic logging interface in Java 9 📎

Java 9 comes with a minimal logging interface: System.Logger with default implementation returned by System#getLogger:


@Test
public void log() {
    System.Logger LOG = System.getLogger(LoggerTest.class.getName());
    System.out.println("Default System.Logger implementation: " + LOG.getClass().getName());
    LOG.log(System.Logger.Level.INFO, "hello java 9 logging");
}

output:

    Default System.Logger implementation: sun.util.logging.internal.LoggingProviderImpl$JULWrapper
    Nov 01, 2017 5:56:46 AM com.airhacks.logging.LoggerTest log
    INFO: hello java 9 logging

See you at Java EE 8 on Java 9, at Munich Airport, Terminal 2