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
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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
Views
Replies
Total Likes
Hello @AishwaryaKa
What is the Java version in use?
Java 11+ GC Parameters example :
-Xlog:gc*,gc+ref=debug,gc+heap=debug,gc+age=trace:file=/mnt/crx/author/crx-quickstart/logs/gc-%p-%t.log:tags,uptime,time,level:filecount=10,filesize=50m
(Don't use both -XX:+PrintGCDetails (Java 😎 and -Xlog:gc* (Java 11+) together)
Views
Replies
Total Likes
Hi @muskaanchandwani ,
The java version we use currently in Java-11.
Views
Replies
Total Likes
You can try one of these.
Basic logging:
-Xlog:gc*=info:file=/path/to/gc.log:time,uptime,level,tagsDetailed logging:
-Xlog:gc*=info,gc+phases=debug:file=/path/to/gc.log:time,uptime,level,tagsComplete debug-level logging:
-Xlog:gc*=debug:file=/path/to/gc.log:time,uptime,level,tags
Views
Replies
Total Likes
Hello @AishwaryaKa , thanks for confirming
could you please try below -
1. Edit your AEM start script
Open:
crx-quickstart/bin/start
2. Add the Java 11 GC logging flag
(only -Xlog)
-Xlog:gc*,gc+ref=debug,gc+heap=debug,gc+age=trace:file=crx-quickstart/logs/gc-%p-%t.log:time,uptime,level,tags:filecount=10,filesize=50m
(Place it after your -Xms / -Xmx settings)
3. Avoid adding GC tuning parameters unless required - Only add the -Xlog parameter
4. Remove old Java 8 GC flags (if present)
Delete below flags:
-Xloggc
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintTenuringDistribution
-XX:+PrintGCTimeStamps
5. Ensure directory exists & writable : crx-quickstart/logs/
6. Restart AEM
Views
Replies
Total Likes
Views
Likes
Replies