How To
ForgeRock Identity Platform
Does not apply to Identity Cloud

How do I enable Garbage Collector (GC) Logging for IDM?

Last updated Jan 12, 2023

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


Overview

Unified JVM Logging is used for GC logging in Java® 11. The logging options available in Java 8 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:

The file (Java 11) or Xloggc (Java 8) properties are optional; if omitted, the GC data is written to the openidm.log file (located in the /path/to/idm/logs directory). This can be useful when trying to correlate GC events with events occurring within the server instance.

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)

You should enable GC logging via the OPENIDM_OPTS environment variable. You can either add them prior to starting IDM as demonstrated below or you can edit the startup.sh or startup.bat files to update the default OPENIDM_OPTS values.

On Unix® and Linux® systems:

  1. Enter something similar to the following prior to starting IDM to enable GC logging:$ cd /path/to/idm/ $ export OPENIDM_OPTS="-Xlog:gc=debug:file=/tmp/gc.log:time,uptime,level,tags:filecount=5,filesize=100m" $ ./startup.shThere are many options available as detailed in JEP 158: Unified JVM Logging but this is a good starting point.

Once IDM has started, there should be a GC log file located in the directory specified in the file: option or GC data included in the openidm.log file. 

On Microsoft® Windows® systems:

  1. Enter something similar to the following prior to starting IDM to enable GC logging:C:\> cd \path\to\idm C:\path\to\idm> set OPENIDM_OPTS=-Xlog:gc=debug:file=C:\tmp\gc.log:time,uptime,level,tags:filecount=5,filesize=100m C:\path\to\idm> startup.batThere are many options available as detailed in JEP 158: Unified JVM Logging but this is a good starting point.

Once IDM has started, there should be a GC log file located in the directory specified in the file: option or GC data included in the openidm.log file.

Enabling GC Logging (Java 8)

You should enable GC logging via the OPENIDM_OPTS environment variable. You can either add them prior to starting IDM as demonstrated below or you can edit the startup.sh or startup.bat files to update the default OPENIDM_OPTS values.

Note

GC logs will be overwritten when the server restarts unless you have implemented a log rotation strategy; log rotation is also important for managing disk space. You can enable GC log rotation by including the following options when you enable GC logging: -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=n -XX:GCLogFileSize=nHowever, using these options can lead to situations where rotated files end up in an unexpected order; see Rotating GC Log Files for further information and alternatives.

On Unix and Linux systems:

  1. Enter the following prior to starting IDM to enable GC logging:$ cd /path/to/idm/ $ export OPENIDM_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintGCCause -Xloggc:[filename]" $ ./startup.shreplacing [filename] with the path to the file that you would like to create to store the log file.

Once IDM has started, there should be a GC log file located in the directory specified in the -Xloggc: option or GC data included in the openidm.log file. 

On Microsoft Windows systems:

  1. Enter the following prior to starting IDM to enable GC logging:C:\> cd \path\to\idm C:\path\to\idm> set OPENIDM_OPTS=-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintGCCause -Xloggc:[filename] C:\path\to\idm> startup.batreplacing [filename] with the path to the file that you would like to create to store the log file.

Once IDM has started, there should be a GC log file located in the directory specified in the -Xloggc: option or GC data included in the openidm.log file.

See Also

Best practice for JVM Tuning with G1 GC

Best practice for JVM Tuning with CMS GC

How do I change the JVM heap size for IDM?

How do I collect JVM data for troubleshooting IDM?

FAQ: IDM performance and tuning


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