2009-12-02 84 views
2

我打开Java的GC日志选项添加时间戳到Java的GC消息在Tomcat中6

-XX:+ PrintGC -XX:+ PrintGCTimeStamps -XX:+ PrintGCDetails

哪个打印出这些消息到标准输出(catalina.out中):

314.884: [CMS-concurrent-mark-start] 
315.014: [CMS-concurrent-mark: 0.129/0.129 secs] [Times: user=0.14 sys=0.00, real=0.13 secs] 
315.014: [CMS-concurrent-preclean-start] 
315.016: [CMS-concurrent-preclean: 0.003/0.003 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
315.016: [CMS-concurrent-abortable-preclean-start] 
332.055: [GC 332.055: [ParNew: 17128K->84K(19136K), 0.0017700 secs] 88000K->70956K(522176K) icms_dc=4 , 0.0018660 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
CMS: abort preclean due to time 352.253: [CMS-concurrent-abortable-preclean: 0.023/37.237 secs] [Times: user=0.78 sys=0.02, real=37.23 secs] 

我怎样才能让这些日志线出现与实际时间戳(包括日期),而不是这些数字,这大概意味着“JVM启动以来的时间”?

回答

1

据我所知这不能做到。据 sun documentation

The format is not guaranteed to be the same in later releases. In particular the output associated with -XX:+PrintGCDetails is almost guaranteed to change in that it represents the current needs of JVM developers. 

诚然,这是一个古老的参考(用于Java 1.4!),但我能找到什么更多的电流,而上一次我们小组通过GC调去了,几个月前,我们看到了什么在当前的文档中专门处理格式。

1

检查此blog entry关于如何在GC日志文件中显示人类可读的时间戳。