Enabling GC logging for a DataSource’s JVM
Caplin Support recommend enabling garbage collection (GC) logging for production Java virtual machines (JVMs). Garbage collection logs provide valuable information for tuning a JVM’s heap size and investigating performance and memory problems.
For a detailed reference on JVM logging options, see the java
command reference (Java 8) and Unified JVM Logging (Java 11).
Enabling GC logging for a C DataSource
C DataSources include Liberator, Transformer, and the TREP Adapter.
The following examples show the jvm-options
used to configure GC logging for versions of Java supported by Caplin Platform 7. Add the appropriate configuration below to your DataSource’s java.conf
file:
jvm-options -XX:+PrintGCDetails jvm-options -XX:+PrintGCDateStamps jvm-options -XX:+UseGCLogFileRotation jvm-options -XX:NumberOfGCLogFiles=10 jvm-options -XX:GCLogFileSize=5M jvm-options -XX:+PrintConcurrentLocks jvm-options -XX:+PrintCommandLineFlags jvm-options -XX:+HeapDumpOnOutOfMemoryError (1) jvm-options -XX:HeapDumpPath=var
jvm-options -Xlog:gc:file=var/gc-%p.log:tags,time,uptime,level:filecount=10,filesize=5M jvm-options -XX:+HeapDumpOnOutOfMemoryError (1) jvm-options -XX:HeapDumpPath=var
1 | If the DataSource’s JVM runs out of memory, dump the JVM heap before terminating the JVM. A heap dump can provide valuable information to Caplin Support. |
Enabling GC logging for a Java DataSource
Java DataSources include Caplin RET Adapter Toolkit, the Caplin Barracuda Adapter, and the Caplin Wallstreet Adapter.
To enable GC logging for a Java DataSource, add the appropriate command-line options below to the java
command in the DataSource’s DataSource/bin/start-jar.sh
script:
-Xloggc:var/gc-%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=5M -XX:+PrintConcurrentLocks -XX:+PrintCommandLineFlags -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=var
-Xlog:gc:file=var/gc-%p.log:tags,time,uptime,level:filecount=10,filesize=5M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=var
See also:
-
java
command reference (Java 8) -
Unified JVM Logging (Java 11)