liveBook · Manning

JVM option

As explained in Troubleshooting Java, Second Edition

A JVM option is a configuration argument supplied to the Java Virtual Machine to control its runtime behavior.

A JVM option is a configuration argument that changes how the Java Virtual Machine runs. For GC troubleshooting, use one to enable logging and direct events into a separate file instead of a crowded terminal. section 11.2

Use JVM options to make runtime behavior observable and investigation practical:

  • Choose a writable destination for the GC-log file. section 11.2
  • Add time, uptime, level, and tags so each event has useful context. section 11.2
  • Review the resulting file with a specialized analyzer when pauses, memory spikes, or high CPU usage need investigation. section 11.0 section 11.2

Store GC logs during application startup

Run `java -Xlog:gc*:file=gc.log:time,uptime,level,tags -jar yourApp.jar`. After the application runs, inspect `gc.log`; it contains formatted GC events that can be retained, shared, filtered, or uploaded for analysis. section 11.2

-Xlog:gc*:file=<file_path>:time,uptime,level,tags

The option’s structure makes the destination and four diagnostic fields explicit. section 11.2

How Troubleshooting Java, Second Edition covers it

How deep it goes
Explains option placement, file permissions, and log fields, but defers broader JVM tuning details.
Examples
Uses a Java startup command, an IDE runtime setting, a formatted GC-log file, and GCeasy analysis.
What it assumes
Assumes basic Java application launching and introduces GC logging as a diagnostic starting point.
What you can do after
Operate/configure a Java application with GC logging enabled and preserve its events for later diagnosis.
How it connects
Connects JVM options with GC logs, heap size, full GC cycles, memory leaks, and performance troubleshooting.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Troubleshooting Java, Second Edition. The section links point to the parts of the book it draws on.