Edit Modify the catlian.sh file to add the following information:
-XX:+PRINTGC//Turn on GC log monitoring-xx:+printgcdetails//You can learn more about the changes in the GC-xx:+printgctimestamps//You can see how long these garbage collections took place, measured in seconds since the JVM started-XX : +printgcdatestamps//GC Time information-XX:+PRINTHEAPATGC//Understanding Heap For more detailed information-xloggc:/opt/tomcat_8080/logs/gc.log
Example:
[email protected] ~]$ sudo vim/opt/tomcat_8080/bin/catalina.sh
Java_opts= "-xms1024m-xmx1024m-xx:permsize=512m-xx:maxpermsize=512m# Add the following:-xx:+printgc-xx:+printgcdetails-xx:+ Printgctimestamps-xx:+printgcdatestamps-xx:+printheapatgc-xloggc:/opt/tomcat_8080/logs/gc.log "
You will need to restart the TOMCA app after you modify it to take effect. Restart as follows: [[Email protected] ~]$ ll /opt/tomcat_8080/logs/gc.log-rw-r--r-- 1 root root 506 Dec 16 13:15 /opt/tomcat_8080/logs/gc.log[[email protected] ~]$ tailf /opt/tomcat_8080/logs/gc.log java hotspot (TM)  64-BIT SERVER VM (25.60-B23) for linux-amd64 JRE (1.8.0_60-b27), built on aug 4 2015 12:19:40 by "Java_re" with gcc 4.3.0 20080428 (Red hat 4.3.0-8) memory: 4k page, physical 8061236k (276644k free), swap 0k (0k free) commandline flags: -xx:initialheapsize=1073741824 -xx:+managementserver -xx:maxheapsize=1073741824 -xx:+printgc -xx:+printgcdatestamps -xx:+printgcdetails - Xx:+printgctimestamps -xx:+printheapatgc -xx:+usecompressedclasspointers -xx:+usecompressedoops &nbsP;-xx:+useparallelgc
This article is from "Barley tea" blog, please be sure to keep this source http://damaicha.blog.51cto.com/6046098/1883305
Tomcat turns on GC logs