Collect garbage collection (GC) logs for an on-premises Mule Runtime instance.
Collect garbage collection (GC) logs on an on-premises Mule Runtime so you can diagnose heap and pause-time issues. CloudHub workers do not expose wrapper.conf. This article does not apply to CloudHub.
The JVM flags you add in Option 2 depend on the JDK major version, not on ParallelGC versus G1GC. Mule 4.6 long-term support (LTS) still runs Java 8, 11, and 17. Mule 4.9 and later run Java 17 only. See Java Support | MuleSoft Documentation.
Install a JDK, not only a JRE. jstat is a JDK tool. Oracle documents it as experimental and unsupported. Replace <pid> with the operating-system process ID of the Mule JVM, then run:
jstat -gccause -h 1000 -t <pid> 10s > gc.log
The command writes samples to gc.log every 10 seconds and prints a column header every 1000 samples. You do not restart Mule. The Timestamp column is elapsed time in seconds since the target JVM started, not milliseconds. Young-generation GC count (YGC), full GC count (FGC), and the GC time columns are cumulative. See The jstat Command.
When only a JRE is installed, or you need a rotating GC log file from JVM start, add unused wrapper.java.additional.<n> lines in $MULE_HOME/conf/wrapper.conf. Each <n> must be unique. If two lines share the same number, the Java Service Wrapper keeps one and ignores the other. Do not edit wrapper-additional.conf; Mule regenerates that file. After you change wrapper.conf, stop and start Mule so the new flags apply. See Download, Install, Configure, and Upgrade On-Premises Mule Runtime Engine | MuleSoft Documentation.
On Java 8, add these flags. Uncomment them if they are already present and commented out. Replace each <n> with a unique unused sequence number:
wrapper.java.additional.<n>=-XX:+PrintGCApplicationStoppedTime
wrapper.java.additional.<n>=-XX:+PrintGCDetails
wrapper.java.additional.<n>=-XX:+PrintGCDateStamps
wrapper.java.additional.<n>=-Xloggc:%MULE_HOME%/logs/gc.log
wrapper.java.additional.<n>=-XX:+UseGCLogFileRotation
wrapper.java.additional.<n>=-XX:NumberOfGCLogFiles=5
wrapper.java.additional.<n>=-XX:GCLogFileSize=10M
To keep a new file across restarts, include the process ID (%p) and a timestamp (%t) in the -Xloggc file name:
wrapper.java.additional.<n>=-Xloggc:%MULE_HOME%/logs/gc-%p-%t.log
On Java 11 and Java 17, the Java 8 PrintGC flags are removed. The JVM exits with Unrecognized VM option for PrintGCApplicationStoppedTime, PrintGCDetails, and -Xloggc. That failure is the JDK version, not G1GC versus ParallelGC. See Mule 4 Application on Java 11 or Java 17 Fails to Start Due to Certain Deprecated GC Logging Flags Enabled.
Use unified logging instead. Oracle maps -XX:+PrintGCDetails to -Xlog:gc* and -Xloggc:filename to -Xlog:gc:filename. Add one unused sequence number:
wrapper.java.additional.<n>=-Xlog:gc*:file=%MULE_HOME%/logs/gc.log:tags,time,uptime,level:filecount=10,filesize=2M
After you have the logs, see How to analyze GC logs effectively.
001115026

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.