Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

«

»

Feb 12

How to enable garbage collection logging (GC logs) in Apache tomcat




In this article I’ll provide information about how to enable garbage collection logging (GC logs) in Apache tomcat.

GC logs are very important when you are debugging an application. GC logs helps to analyse how your program uses the memory.

GC logs also helps to find how often garbage collector cleans the memory for unused objects.

So, you can enable garbage collection logging in few simple steps, that are as follows:

for this you need a file named setenv.sh in the $TOMCAT_HOME/bin directory. Create one if it doesn’t exists.

setenv.sh is executed when Apache Tomcat is started and sets the JVM options needed to enable garbage collection logging.

 

Restart Apache Tomcat to enable the changes.

look into tomcat’s logs directory you will find gc.log file, and you can analyse your GC logs 🙂

 References:

http://tomcat.apache.org

Java VM Options

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: