How to Enable Garbage Collection logging for Tomcat Java
book
Article ID: 1000766407
calendar_today
Updated On:
Description
Steps to perform:
Make a backup of D:\CW\V1XX\tomcat\bin\catalina.bat file to D:\CW\V1XX\tomcat\bin\catalina.bat.bak_CFT8644
Stop eDP Services
Open the catalina.bat file in notepad.exe
Find the the line that begins with the following:
set JAVA_OPTS=%JAVA_OPTS% -server -XX:+UseG1GC -XX:MaxGCPauseMillis=200
And add the "REM " to the front so that this line is ignored. Should now look similar to:
REM set JAVA_OPTS=%JAVA_OPTS% -server -XX:+UseG1GC -XX:MaxGCPauseMillis=200
Then under that line add the following lines:
rem CFT-8644 : MetaspaceSize 2g, free ratios removed set JAVA_OPTS=%JAVA_OPTS% -server -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:CompressedClassSpaceSize=2g -XX:MetaspaceSize=2g -XX:+ClassUnloading -XX:+ClassUnloadingWithConcurrentMark
rem CFT-8644 : GC logging if not exist "%ESA_HOME%\logs\gc" mkdir "%ESA_HOME%\logs\gc" set JAVA_OPTS=%JAVA_OPTS% -Xloggc:%ESA_HOME%\logs\gc\server-gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCCause -XX:+PrintReferenceGC -XX:+PrintAdaptiveSizePolicy -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution -XX:+PrintHeapAtGC -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=20 -XX:GCLogFileSize=50M
IMPORTANT Note: The set lines can be long and likely showing as two or more lines, but each set line should only be one line each in the catalina.bat file.
Start eDP services.
After eDP is running, a new folder called gc will be created in the eDP D:\CW\V1XX\logs folder. This is where the Garbage Collector logs will be written.
Wait until the UI slowness occurs again, document the date and time when the issue was reported, create a support case for UI Slowness, and attach a full set of logs including the logs from the gc folder to the support case. Also, reference this technote was used in order to collect the additional GC logging.
Once logs are collected and sent into a new support case, the additional debugging should be disabled. Remove the catalina.bat file and then rename the catalina.bat.bak_CFT8644 back to catalina.bat.
Restart all eDP services.
Environment
Customers experiencing this issue are encouraged to create a Technical Support case, provide the logs by attaching to the support case, and reference this technote and that the steps from this technote were followed.
Issue/Introduction
Steps to increase the Metaspace for java and how to enable Garbage Collection logging in order to gather information for engineering to further investigate the slow User Interface (UI).