7

I want to understand the difference between: -XX:+PrintGC and -verbose:gc Apparently these look similar.

This article doesn't list the verbose:gc http://www.oracle.com/technetwork/articles/java/vmoptions-jsp-140102.html

I also saw these two questions: How to redirect verbose garbage collection output to a file? and https://stackoverflow.com/a/1818039/2266682 but couldn't get much understanding.

Syed Aqeel Ashiq
  • 1,347
  • 3
  • 17
  • 50

1 Answers1

14

In JDK 8 -verbose:gc is an exact alias for -XX:+PrintGC.

However, -verbose:gc is a standard option, while -XX:+PrintGC is not.

-XX:+PrintGC is deprecated since JDK 9 in favor of unified logging option -Xlog:gc, see JEP 158.
-verbose:gc still works in JDK 9 and 10.

apangin
  • 79,047
  • 9
  • 168
  • 200