如何追加gc日志 [英] how to append gc log

查看:96
本文介绍了如何追加gc日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是gc日志记录选项,用于写入特定文件

below is gc logging option to write the specific file

-verbose:gc
-Xloggc:/logs/gc.log

好.好的. 但是重新启动Java应用程序后,文件中的旧gc日志内容消失了. 我希望vm将追加 gc日志添加到"/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.

是否存在此选项?还是我必须编写Shell脚本来备份旧的gc文件?

does option for this exist? or i have to write shell script to back up old gc file?

推荐答案

您明确要求gc数据进入名为"gc.log"的文件.您可以附加日期& pid 到文件名以防止这种冲突. Hotspot中没有机制可以防止数据被覆盖.

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.

这篇关于如何追加gc日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆