In Java 9 and onwards, OpenJDK introduced the unified logging framework for logging. See JEP 158 for details.
Garbage collection (GC) logging now leverages this framework in Java 9 and later releases. See JEP 271. GC arguments that you currently have in place for Java 8 won't work in Java 11. For additional details, watch the following sessions:
- QCon session by Twitter's Tony Printezis from 2016
- Devoxx session by Oracle's Poonam Parhar from March 2017
- Bangalore JUG (Java User Group) session by Oracle's Fairoz Matte from September 2017
This new logging framework introduces the concept of log levels, tags, and decorators, with gc being one of the tags. Try the command:
The following table lists all of the log levels:
The basic format to use is this:
- You can pass in the following argument for AEM. %p represents the process ID of the Java process. %t prints the timestamp for when the log was created. Maximum file size is 50 MB, and file rollover happens after 10 files:
- Although safepoints are not always related to garbage collection, they do affect the performance of the application. For example, thread dumps require the JVM to reach a safepoint. Out of the box, AEM triggers thread dumps every minute! (this behaviour can be configured better in /system/console/configMgr). Therefore we need to keep track of JVM pauses caused by safepoints (in a separate log file). So adding the following is a good idea as well. For more on JVM safepoints, watch this 2015 session by Azul's John Cuthbertson.