Logging in Java 9

Prior to Java 9, there were multiple logging schemas available, including java.util.logging, SLF4J, and Log4J. The latter two are third-party frameworks that have separate facade and implementation components. This pattern has been replicated in the new Java 9 platform.

Java 9 introduced changes to the java.base module so that it would handle logging functions and not rely on the java.util.logging API. It has separate facade and implementation components. This means that when using third-party frameworks, the JDK only needs to provide the implementation component and return platform loggers that work with the requesting logging framework.

As you can see in the following illustration, we use the java.util.ServiceLoader API ...

Get Java 9: Building Robust Modular Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.