Enable GC logging of controllers

1 minute read

You can enable GC logging for troubleshooting purposes.

To enable GC logging:

  1. Access the operations center UI, and click the "gear icon" for the controller you want to modify.

  2. Click Configure on the left pane to access the controller’s configuration.

  3. In the section labeled Java Option, add the following and select Save.

    -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=40m -Xloggc:$JENKINS_HOME/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC -XX:+PrintGCCause -XX:+PrintTenuringDistribution -XX:+PrintReferenceGC -XX:+PrintAdaptiveSizePolicy



Restart the controller for the changes to take effect, From the main operations center page, select the name of the controller → Manage → Restart.


Accessing the GC Logs

By default the GC logs are written to $JENKINS_HOME which is related to /var/jenkins_home/.

To write GC logs to the overlay filesystem and not to the PersistantVolume modify the variable `$JENKINS_HOME the directory needs to be writeable by the container 


This will write the GC logs to `/tmp.