How to Enable Garbage Collection (GC) Logging in Crowd

Still need help?

The Atlassian Community is here for you.

Ask the community

Purpose

Garbage collection logs are useful when debugging memory-related issues within Java-based applications.

For Linux

Add the following parameters to JAVA_OPTS in your <crowd-install>/apache-tomcat/bin/setenv.sh file. Note that the <crowd-home> reference below is just a placeholder variable. Please be sure to enter the actual path for your <crowd-home> directory:

-Xloggc:<crowd-home>/logs/`date +%F_%H-%M-%S`-gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCCause
-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=5M

For Windows

Batch file

If you start Crowd using start_crowd.bat, add the below code to <crowd-install>/apache-tomcat/bin/setenv.bat

rem Create a timestamp with date and time, replacing ' ' with '0' and '/' with '-'
set atlassian_timestamp=%DATE:~-4%.%DATE:~4,2%.%DATE:~7,2%_%TIME:~0,2%.%TIME:~3,2%.%TIME:~6,2%
set atlassian_timestamp=%atlassian_timestamp: =0%
set atlassian_timestamp=%atlassian_timestamp:/=-%
set atlassian_logsdir=%~dp0..\logs

set JAVA_OPTS=%JAVA_OPTS% -Xloggc:"%atlassian_logsdir%\gc-%atlassian_timestamp%.log"
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=5M -XX:+PrintGCCause
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution 

NB: This will create the garbage collection logs in the <crowd-install> directory.

Service

If you start Crowd as a Windows Service, add the below parameters to the service by following the "Additional Crowd Setup Options" section in this document (be sure to substitute the actual the path for your <crowd-home> directory below)

-Xloggc:<crowd-home>\logs\gc-%t.log
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintGCCause
-XX:+PrintTenuringDistribution
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=10
-XX:GCLogFileSize=5M

Last modified on Jun 27, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.