How To
ForgeRock Identity Platform
Does not apply to Identity Cloud

How do I enable Garbage Collector (GC) Logging for DS (All versions)?

Last updated Jun 15, 2021

The purpose of this article is to provide information on enabling GC Logging for DS. It assumes you already have a working DS server installed.


2 readers recommend this article

Overview

Unified JVM Logging is used for GC logging in Java® 11. The logging options available in Java 8 and earlier will not work with Java 11. See JEP 158: Unified JVM Logging for further information.

This article provides details on enabling GC logging according to which version of Java you are using:

You can use the Universal GC Log Analyzer to analyze your GC log. This is a third-party website that we suggest can be used for analysis but is not supported by ForgeRock.

Enabling GC Logging (Java 11)

On Unix® and Linux® systems:

You can enable GC logging as follows:

  1. Locate and edit your /path/to/ds/config/java.properties file for the DS instance for which you want to enable GC Logging.
  2. Append the required options to the entry start-ds.java-args=. For example: start-ds.java-args=-server -Xlog:gc=debug:file=/tmp/gc.log:time,uptime,level,tags:filecount=5,filesize=100mThere are many options available as detailed in JEP 158: Unified JVM Logging but this is a good starting point.
  3. Restart the DS server.

Once the server has successfully restarted, there should be a GC log file located in the directory specified in the file: option. 

On Microsoft® Windows® systems:

You can enable GC logging as follows:

  1. Locate and edit your \path\to\ds\config\java.properties file for the DS instance for which you want to enable GC Logging.
  2. Append the required options to the entry start-ds.java-args=. For example: start-ds.java-args=-server -Xlog:gc=debug:file=C:\tmp\gc.log:time,uptime,level,tags:filecount=5,filesize=100mThere are many options available as detailed in JEP 158: Unified JVM Logging but this is a good starting point.
  3. Restart the DS server.

Once the server has successfully restarted, there should be a GC log file located in the directory specified in the file: option.

Enabling GC Logging (Java 8 and earlier)

Note

You should ensure there is enough disk space for the GC logs; if not, you should enable GC log rotation as well by including the following options when you enable GC logging: 

-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=n -XX:GCLogFileSize=n

On Unix and Linux systems:

You can enable GC logging as follows:

  1. Locate and edit your /path/to/ds/config/java.properties file for the DS instance for which you want to enable GC Logging.
  2. Append the following options to the entry start-ds.java-args= -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintGCCause -Xloggc:[filename]replacing [filename] with the path to the file that you would like to create to store the log file. For example: start-ds.java-args=-server -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintGCCause -Xloggc:/tmp/gc.log
  3. Restart the DS server.

Once the server has successfully restarted, there should be a GC log file located in the directory specified in the -Xloggc: option.

On Microsoft Windows systems:

You can enable GC logging as follows:

  1. Locate and edit your \path\to\ds\config\java.properties file for the DS instance for which you want to enable GC Logging.
  2. Append the following options to the entry start-ds.java-args= -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintGCCause -Xloggc:[filename]replacing [filename] with the path to the file that you would like to create to store the log file. For example: start-ds.java-args=-server -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintGCCause -Xloggc:C:\tmp\gc.log
  3. Restart the DS server.

Once the server has successfully restarted, there should be a GC log file located in the directory specified in the -Xloggc: option.

See Also

Best practice for JVM Tuning with G1 GC

Best practice for JVM Tuning with CMS GC

How do I tune DS (All versions) process sizes: JVM heap and database cache?

How do I collect JVM data for troubleshooting DS (All versions)?

FAQ: DS performance and tuning

Java Settings

Related Training

ForgeRock Directory Services Core Concepts (DS-400) 

Related Issue Tracker IDs

N/A


Copyright and Trademarks Copyright © 2021 ForgeRock, all rights reserved.