10

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 //www.greatytc.com/a/1818039/2266682 but couldn't get much understanding.

1 Answer 1

18

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.

2
  • Not clear about -verbose:gc. Does it do anything in JDK9+? Or -Xlog:gc is enough
    – turbanoff
    Commented Oct 5, 2020 at 16:23
  • 1
    @turbanoff -verbose:gc acts exactly like -Xlog:gc
    – apangin
    Commented Oct 5, 2020 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.