Difference between -XX:+PrintGC and -verbose:gc
Asked Answered
A

1

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 https://mcmap.net/q/733446/-what-do-xx-printgc-and-xx-printgcdetails-flags-do but couldn't get much understanding.

Altruistic answered 2/4, 2018 at 9:54 Comment(0)
S
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.

Syllabub answered 2/4, 2018 at 10:30 Comment(2)
Not clear about -verbose:gc. Does it do anything in JDK9+? Or -Xlog:gc is enoughTruncation
@Truncation -verbose:gc acts exactly like -Xlog:gcSyllabub

© 2022 - 2024 — McMap. All rights reserved.