Java 9 introduced a unified logging architecture (JEP 158) accessible via the -Xlog JVM option. It consolidates messages from subsystems like class loading, threading, garbage collection, and the module system into a single configurable mechanism. The -Xlog option supports selectors (tag sets and log levels), output targets (stdout, stderr, or file), and decorators (timestamps, PIDs, thread IDs, etc.). Selectors use exact tag matching by default, with a wildcard (*) available for broader matching. Multiple selectors can be combined with commas, and multiple -Xlog flags can be used for different output targets.

8m read timeFrom nipafx.dev
Post cover image
Table of contents
▚ What Is Unified Logging?▚ Defining Which Messages Should Be Shown▚ Defining Where Messages Should Go▚ Defining What Messages Should Say▚ Putting The Pieces Together▚ Reflection

Sort: