DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Memory Optimization and Utilization in Java 25 LTS: Practical Best Practices
  • Optimizing Java Applications for Arm64 in the Cloud
  • Debugging Performance Regressions in High-Scale Java Web Services: A Systematic Approach
  • Memory Leak Due To Mutable Keys in Java Collections

Trending

  • Architecting an Embedded Efficiency Layer: A Platform Deep Dive into Day-Two Operational Tuning
  • Java in a Container: Efficient Development and Deployment With Docker
  • Retesting Best Practices for Agile Teams: A Quick Guide to Bug Fix Verification
  • Stop Running Two Data Systems for One Agent Query
  1. DZone
  2. Coding
  3. Languages
  4. Disruptive Changes to GC Logging in Java 9

Disruptive Changes to GC Logging in Java 9

Garbage collection fanatics have likely noticed some pretty hefty changes to GC in Java 9. See what's been deprecated, what's been removed, and what' changed.

By 
Ram Lakshmanan user avatar
Ram Lakshmanan
DZone Core CORE ·
Oct. 27, 17 · News
Likes (5)
Comment
Save
Tweet
Share
34.8K Views

Join the DZone community and get the full member experience.

Join For Free

GC logs are vital artifacts for troubleshooting memory/CPU problems and optimizing application performance. In September 2017, the much-awaited Java 9 was released. In Java 9, GC logging has been re-implemented using the Unified GC logging framework (JEP 271). Some changes are surprising, and some changes might be shocking.

Here are the changes made to GC logging in Java 9:

  1. Three popular GC logging system properties have been deprecated.
  2. 43 GC logging system properties have been removed (Note: It’s ‘removed’ and not ‘deprecated’).
  3. GC log formatting has changed.

This article walks you through the steps that you need to follow when migrating the applications to Java 9.

Deprecated GC Logging Properties

Most Java applications use these three GC logging system properties:

  • -XX:+PrintGC
  • -XX:+PrintGCDetails
  • -Xloggc:<gc-log-file-path>

These three system properties are deprecated in Java 9; they will be removed in upcoming Java releases. It’s advised to replace these system properties with the newly introduced system properties in Java 9.

Here are the old systems property equivalents in Java 9.

Until Java 8 Java 9
-XX:+PrintGCDetails -Xloggc:<gc-log-file-path> -Xlog:gc*:file=<gc-log-file-path>
-XX:+PrintGC -Xloggc:<gc-log-file-path> -Xlog:gc:file=<gc-log-file-path>

GC Logging System Properties Removed

First, it’s a surprise to several of us that Java has removed GC logging system properties. Yes, they are removed, not even deprecated. The JVM will not start if you are passing old system properties. Thus, you are forced to replace these system properties in Java 9. This table summarizes the old system properties and their equivalents in Java 9.

Image title

GC Log Format Change

The Java GC log format has been migrated to the Unified JVM Logging framework in Java 9. Thus, GC logs will start to look different from earlier versions. Say you are using G1 GC. Below is how the GC log format would have looked in Java 8:

major change

In Java 9, the GC log will start to look like below:

Major1

You can see additional information such as relative time (i.e. ‘[2.799s]’), log level (i.e. trace, debug, info), and GC event number (i.e. GC(0)) printed in Java 9's GC log format. Those were prevented in Java 8. Besides the new additions, there are also changes in the certain events as well.

This format change is applicable to all GC algorithms as well (i.e. Serial, CMS, Parallel, Shenandoah) and not just G1 GC. So, if you are using any custom scripts/tools to analyze GC logs, those scripts/tools will need to be enhanced to support this new format.

To analyze new Java 9 GC log you may consider using free tools such as GCeasy tool, HP Jmeter, etc. These tools parse the new unified GC logging formats and generate reliable reports.

garbage collection Java (programming language)

Opinions expressed by DZone contributors are their own.

Related

  • Memory Optimization and Utilization in Java 25 LTS: Practical Best Practices
  • Optimizing Java Applications for Arm64 in the Cloud
  • Debugging Performance Regressions in High-Scale Java Web Services: A Systematic Approach
  • Memory Leak Due To Mutable Keys in Java Collections

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook