【问题标题】:Adding Timestamp to Java's GC messages in Tomcat 6在 Tomcat 6 中为 Java 的 GC 消息添加时间戳
【发布时间】:2009-12-02 17:28:50
【问题描述】:

我打开了 Java 的 GC 日志选项

-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 启动以来的时间”?

【问题讨论】:

    标签: java logging garbage-collection


    【解决方案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 调整时,我们在当前文档中没有看到任何专门解决格式问题的文档。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-19
      • 2013-09-16
      • 2017-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多