Profile Image
vishnupriya

What is Garbage Collector logging: -Xloggc?

What is Garbage Collector logging: -Xloggc? 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

  • xloggc

  • loggc

  • Garbage Collector logging

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:

 

-Xloggc:path-to-file.

 

Examples:

 

Show all messages for garbage collector to file:

 

java -Xloggc:gc.log

 

Description:

 

Logging of the garbage collector related information is possible using –Xloggc. It will create and rotate a file containing log information. After Java 9 was released it is possible to use –Xlog specifying gc as a tag, and the –Xloggc is available but deprecated.

 

Default Value:

 

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

 

java -Xloggc:gc.log -version

 

[0.012s][info][gc] Using G1

 

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

 

Errors:

 

None

 

Arguments related:

 

TODO link log, +UseGCLogFileRotation, NumberOfGCLogFiles, GCLogFileSize

 

Related Posts:

NOTE:

 

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

  • xloggc

  • loggc

  • Garbage Collector logging