Reputation: 552
I've tried to configure in both eclipse and intelliJ arguments with garbage collection logger for simple test program. Tried different kind of configurations and the log file has not been created.
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:gc.log
The garbage collection I prefer to create log from is G1 if possible.
Upvotes: 4
Views: 5609
Reputation: 11638
The -X
or -XX
params are VM options and not program arguments, which makes me think that if you did not get any errors you may have it incorrectly passed to your program.
I get the following when using your params:
Unrecognized VM option 'PrintGCDateStamps'
By removing it, it worked fine and generated gc.log
.
Via IDE
Via Command Line
$ java -Xloggc:gc.log com/stackoverflow/Main
-Xloggc is deprecated
<= Java 8 -Xloggc:filename.log
>= Java 9 -Xlog:gc:filename.log
Using -Xloggc
with a modern JVM still works but gives a warning:
[0.005s][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:gc.log instead.
Upvotes: 7