How to collect garbage collection information

Stop The World and gather data: The importance of GC logs

The richest source of data for the state of garbage collection in a system based on a

HotSpot JVM are the GC logs. If your JVM is not generating GC logs with timestamps, you’re

missing out on a critical source of data to analyze and solve pausing issues. This is true

for development environments, staging, load testing and most importantly, in production.

You can get data about all GC events in your system, whether they were completed

concurrently or caused a stop-the-world pause: how long did they take, how much CPU they

consumed, and how much memory was freed. From this data, you’re able to understand the

frequency and duration of these pauses, their overhead, and move on to taking actions to

reduce them.

So these are the minimal flags which you can use so that JVM logs all GC related activities which you can later analyze and troubleshoot your application

source -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:mygclogH

Uday Ogra

Connect with me at and lets have some healthy discussion :)

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *