IBM Support

Writing Verbose GC To A Specified Log In Solaris and HP-UX

Question & Answer


Question

How can I write verbose gc output to a log file other than the native_stdout?

Cause

By default, Solaris and HP-UX do not write verbose GC to a log file. This must be configured.

Answer


WAS 8.5.0.2 (and higher), WAS 8.0.0.6 (and higher), WAS 7.0.0.27 (and higher):

Solaris:
Add the following parameters to the generic JVM arguments:

-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintHeapAtGC

-Xloggc:/tmp/gc.log 

To enable log file rotation:
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=10
-XX:GCLogFileSize=10M


notes:
-Xloggc:<fileName>

      ex: -Xloggc:/tmp/gc.log
-XX:+UseGCLogFileRotation
      Enabled GC log rotation, requires -Xloggc
-XX:NumberOfGClogFiles=<num_of_files>     
      Set the number of files to use when rotating logs, must be >= 1. The rotated log files will use the following naming scheme, <filename>.0, <filename>.1, ..., <filename>.n-1.
-XX:GCLogFileSize=<number>K (or M)    
      The size of the log file at which point the log will be rotated, must be >= 8K.

HP:
Add the following parameters to the generic JVM arguments:
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintHeapAtGC

-Xverbosegc:file=/tmp/gc_pid$$.vgc

To enable log file rotation:
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=10
-XX:GCLogFileSize=10M


note: $$ maps to the PID of the java process

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Java SDK","Platform":[{"code":"PF010","label":"HP-UX"},{"code":"PF027","label":"Solaris"}],"Version":"8.5;8.0;7.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg21636533