Suggestions to capture GC log | Community
Skip to main content
Level 2
November 4, 2025
Question

Suggestions to capture GC log

  • November 4, 2025
  • 2 replies
  • 362 views

Hi Team,

 

We are receiving CPU spike issues recently, so to troubleshoot we are planning to configure custom logger to capture gc.log. Could you please let us know some suggestions or class that captures gc.log, so that we can create loggers accordingly.

 

We need to capture under crx-quickstart/logs folder. Kindly let us know some suggestions to proceed further.

 

Thanks,

Aishwarya Karthikeyan

2 replies

giuseppebaglio
Level 10
November 4, 2025

hi @aishwaryaka

To capture Java Garbage Collection logs in your AEM environment, you generally configure JVM options to enable GC logging, as there isn't a specific Java class that "captures" GC logs that you can configure with a logger. 

From Java 9 onwards, GC logging is unified and uses the -Xlog option, for example:

-Xlog:gc*:file=crx-quickstart/logs/gc.log:time,uptime,level,tags:filecount=10,filesize=50M

 

Please refer to this page for further details.

Level 2
November 4, 2025

Hi @giuseppebaglio,

Thanks for suggestion! Could you please let me know if it will work for AEM 6.5.22 as well.

Thanks & regards,

Aishwarya Karthikeyan

giuseppebaglio
Level 10
November 5, 2025

Yes, it will, but pay attention to the Java version used and utilize the proper command options, as mentioned in the article I shared above.

 
muskaanchandwani
Adobe Employee
Adobe Employee
November 4, 2025

Hello @aishwaryaka 

Add JVM parameters to your AEM start script to capture GC logs:

>> For Java 8:
-Xloggc:crx-quickstart/logs/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps


>> For Java 11+:
-Xlog:gc*,gc+heap=debug,gc+pause=debug:file=crx-quickstart/logs/gc.log:time,uptime,level,tags:filecount=10,filesize=20M

File should be created under <AEM>/crx-quickstart/logs/gc.log

This should work for AEM 6.5.22.0

Level 2
November 11, 2025

Hi @muskaanchandwani,

While updating the suggested jvm script in start file, we are unable to start the file. May i know whether any other suggestions on this is there to capture gc.log.

Thanks & regards,
Aishwarya karthikeyan

giuseppebaglio
Level 10
November 11, 2025

What command line did you use, and what error was displayed by the script?

You can try something like this:

export CQ_JVM_OPTS='-Xlog:gc*:file=crx-quickstart/logs/gc.log:time,uptime,level,tags:filecount=10,filesize=50M' java $CQ_JVM_OPTS -jar aem-author-p4502.jar