2009-12-02 66 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日誌文件中顯示人類可讀的時間戳。