Apache Tomcat
To enable garbage collection logging with Apache Tomcat, follow the instructions below:
1. Create a file named setenv.sh
in the $TOMCAT_HOME/bin
directory.
2. Add these entries to the file:
export CATALINA_OPTS="-XX:+PrintGCTimeStamps \
-XX:+PrintGCDetails \
-XX:+PrintGCApplicationStoppedTime \
-XX:+PrintGCApplicationConcurrentTime \
-XX:+PrintHeapAtGC \
-Xloggc:logs/gc.log"
Note: If the setenv.sh
already exists, you need to merge these entries with the existing options.
This script is executed when Apache Tomcat is started and sets the JVM options needed to enable garbage collection logging.
3. Restart Apache Tomcat to enable the changes.
Pivotal tc Server Runtime
To enable garbage collection logging under tc Server:
1. Open the bin/setenv.sh
script for an instance of the runtime using a text editor.
2. Locate the JVM_OPTS
variable.
3. To enable garbage collection logging, modify and add the following:
JVM_OPTS="-XX:+PrintGCTimeStamps \
-XX:+PrintGCDetails \
-XX:+PrintGCApplicationStoppedTime \
-XX:+PrintGCApplicationConcurrentTime \
-XX:+PrintHeapAtGC \
-Xloggc:logs/gc.log"
4. Restart the runtime instance for the changes to take effect.