JVM tool guide · memory

GC Log Analysis: Read JVM Garbage-Collection Logs with GCViewer & gceasy

When a JVM shows excessive GC time or long pauses, the GC log is where the evidence lives. On modern JDKs (9+) GC logging is enabled with -Xlog, and the output can be graphed with GCViewer (a small Java tool) or uploaded to gceasy for an annotated report.

GC log analysis answers two questions: 'how much time is spent collecting' (throughput) and 'how long are individual pauses' (latency). That pairing is what tells you whether to change heap size, switch collectors (G1/ZGC/Shenandoah), or fix an allocation pattern.

Official GCViewer project

Use it when

• You see rising response-time percentiles and suspect GC pauses.

• You want to quantify GC throughput and p99 pauses over a window.

• You are comparing heap sizes or collector choices and want a numeric before/after.

Skip it when

• Your issue is a stale heap (leak), not GC behavior — heap-dump analysis is the tool.

Enable GC logging (JDK 9+)

Use a Unified Logging -Xlog tag selector. A common production setting writes to a rolling file with rotation and includes the GC timestamps and safe-point info.

java -Xlog:gc*,gc+metaspace,gc+ref=info:file=gc.log:time,uptime,level,tags -jar app.jar

Enable GC logging (JDK 8)

Older style, still valid: -XX:+PrintGCDetails with timestamps and dates.

java -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:gc.log -jar app.jar

Read the raw log

Each GC line shows a pause (Pause Young / Pause Full), heap before->after, and the GC cause or reason. Look for frequent Full GCs and long 'Pause Full (Allocation Failure)' entries.

# Show the line type breakdown
grep -Eo 'Pause (Young|Full)[^]]*' gc.log | sort | uniq -c | sort -rn

Analyze with GCViewer

Open the .log in GCViewer for charts of pause time, heap usage and throughput, plus summary metrics like total pauses and max pause. Great when you have an offline log.

Analyze with gceasy

Upload a GC log to gceasy.io for an instant, annotated report: GC throughput %, worst GC pause, GC heap usage trends, and tuning hints — no local install.

Quick start

Get productive in minutes

Minimal comparison run

Capture a log, read the two numbers that matter the most.

java -Xlog:gc=info:file=gc.log -jar app.jar
# then
grep -E 'Pause (Full|Young)' gc.log | wc -l

Frequently asked questions

What does GC throughput of 99% mean?

Throughput = (wall time - GC pause time) / wall time. 99% means 1% of time was paused; below ~97% starts to hurt p99 latency. It answers 'how much time is wasted' not 'are pauses noticeable'.

Modern collector to try for low latency?

ZGC and Shenandoah target sub-millisecond pauses at the cost of some throughput. If GC pressure is allocation-driven, G1 well-tuned usually suffices; measure before switching.

My log shows constant Full GCs — what next?

Check the heap after each Full GC: if it keeps growing to near max before each collection, look for a leak (heap dump + MAT). If it returns to a low baseline but still Full GCs often, the heap is too small — raise -Xmx or tune G1.

Last updated August 2026 · JVM Tools is independent and not affiliated with Oracle.