How to Enable Garbage Collection (GC) Logging in Crowd

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

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

Solution

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:

1 2 -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

1 2 3 4 5 6 7 8 9 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)

1 2 3 4 5 6 7 8 -Xloggc:<crowd-home>\logs\gc-%t.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCCause -XX:+PrintTenuringDistribution -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=5M
Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.