问题
below is gc logging option to write the specific file
-verbose:gc
-Xloggc:/logs/gc.log
OK. Good. but when java app is restarted, old gc log contents in the file disappeared. I hope vm to append gc log to "/logs/gc.log" file.
does option for this exist? or i have to write shell script to back up old gc file?
回答1:
You are explicitly requesting that the gc data goes to a file named 'gc.log'. You can append the date & pid to the filename to prevent this sort of collision. No mechanism within Hotspot exists to prevent the data from being overwritten.
来源:https://stackoverflow.com/questions/6567379/how-to-append-gc-log