Profile Image

What is Unified Logging: -Xlog?

What is Unified Logging: -Xlog? Have you used this JVM argument before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvm-argument

  • xlog

  • log

  • Unified Logging

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky



-Xlog:tag=level:destination:details, where tag – any tag that is used to produce messages(i.e gc – for garbage collector, gc+heap – to add heap, all for all tags), level – log severity level (off, trace, debug, info, warning, error), destination – defines where the messages will go (i.e stdout, stderror, file), details – defines what exactly should be shown as a message (time, uptime, timemillis, uptimemillis, timenanos, uptimenanos, pid, tid, level, tags).




Show all messages for garbage collector with debug level to stdout:


java -Xlog:gc*=debug -version


Show all messages for all tags with info level to file app.txt:


java -Xlog:all=info:app.txt -version




In Java 9 release a unified logging was introduced, a central mechanism configurable with -Xlog to be able to see class loading, threading, garbage collector, module system etc.


Unified logging combines many messages that JVM generates through this architecture, and allows to configure it through the –Xlog option. It allows to log messages from different subsystems i.e. garbage collector, class loading, interaction with the underlying operating system, threading etc.


If passed as is –Xlog it will set the level to info and produce all the messages starting from this level. Additionally you can specify the tag and level, i.e in order to see all messages in all tags from info level you can run


Default Value:


The -Xlog parameter does not have a fixed default value. If not specified then it will not produce any output.  Sample outputs:


java -Xlog:gc=info -version


[0.011s][info][gc] Using G1


[0.026s][info][gc] Periodic GC disabled


openjdk version "13.0.2" 2020-01-14


OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.2+8)


OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.2+8, mixed mode, sharing)






Arguments related:


TODO link loggc


Related Posts



If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your insights will help the entire 10+ million java developer community to develop one standard source of documentation for all the JVM arguments.

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvm-argument

  • xlog

  • log

  • Unified Logging