Setting Garbage collection logging for the JVM

Document created by Bill_Patton Employee on Jul 31, 2015Last modified by SamCreek on Dec 17, 2016
Version 3Show Document
  • View in full screen mode

Sometimes it is needed to log garbage collection when running any JVM.
These JVM parameters can be added to any server while this document talks about adding them to Jboss,
you can use WebSphere's admin console edit the app server and add them as JVM properties there also.

 

For implementing in jboss 6.2 on windows locate the stadalone.bat
Typically C:\jboss-eap-6.2\bin\standalone.conf.bat

edit the standalone.conf.bat find this line:


rem # JVM memory allocation pool parameters - modify as appropriate.
set "JAVA_OPTS=-Xms1G -Xmx2G -XX:MaxPermSize=256M"

 

change it to this line:
rem # JVM memory allocation pool parameters - modify as appropriate.
set "JAVA_OPTS=-Xms1G -Xmx2G -XX:MaxPermSize=256M -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCCause"

 

With this test in place, if you did not redirect to a new log
You will see lines like this in the server.log:

223.014: [GC (Allocation Failure) [PSYoungGen: 410443K->37720K(534016K)] 790868K
->470233K(1233408K), 0.8573984 secs] [Times: user=0.97 sys=0.39, real=0.86 secs]

 

real=0.86 secs   Should always be a round up of , 0.8573984 secs]

 

The above message is a regular GC, there a different messages for a FULL GC

Attachments

    Outcomes