Gc日志可以输出的文件中,通过设置-Xverbosegclog参数,指定对应文件名,虚拟机会把Gc日志输出到该文件:
-Xverbosegclog:<path to file><filename[,X,Y]>
Prints out information about garbage collections to a file. If the integers X and Y are specified, the output is redirected to X files each containing output from Y GC cycles.
-Xverbosegclog:<path to file><filename[,X,Y]>
Prints out information about garbage collections to a file. If the integers X and Y are specified, the output is redirected to X files each containing output from Y GC cycles.