Enable GC logging of controllers

1 minute read

Enable GC logging for troubleshooting purposes.

To enable GC logging:

  1. From the operations center dashboard, select the arrow to the right of your controller, and then select Configure from the dropdown menu.

    operations center dashboard
    Figure 1. Operations center dashboard
  2. In the Java Options field, enter the following command and select Save.

    -Xlog:gc*=info,gc+heap=debug,gc+ref*=debug,gc+ergo*=trace,gc+age*=trace:file=$JENKINS_HOME/gc.log:utctime,pid,level,tags:filecount=2,filesize=100M
    Java Options example
    Figure 2. Java Options example
  3. Navigate to the operations center dashboard, select the arrow to the right of your controller, and then select Manage  Restart to restart the controller for the changes to take effect.

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.

Example:

-Xloggc:/tmp/gc.log

This will write the GC logs to /tmp.