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
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Java 27 Makes G1 the Default Everywhere: How to Test Your Small Containers Before You Upgrade
  • 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

Trending

  • DZone's Article Submission Guidelines
  • How to Submit a Post to DZone
  • You Do Not Need a PhD to Become an AI Engineer: The Essential Skill Stack
  • Kafka vs Flink vs Spark: Do You Really Need Real-Time?

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  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
DZone Core CORE ·
Oct. 27, 17 · News
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
35.1K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

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

  • Java 27 Makes G1 the Default Everywhere: How to Test Your Small Containers Before You Upgrade
  • 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

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • 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