7

-Xlog:gc*:/opt/myapp/gc.log doesn't print timestamp by default. It just has uptimemillis. How to add time to above vm option so that it can print timestamp as well. PS: I am on Java 11 and don't have the luxury to use -XX:+PrintGCDateStamps.

Sagar
  • 5,315
  • 6
  • 37
  • 66
  • Possible duplicate of [Is there a replacement for the garbage collection JVM args in Java 11?](https://stackoverflow.com/questions/54144713/is-there-a-replacement-for-the-garbage-collection-jvm-args-in-java-11/54145207#54145207) – Naman Apr 03 '19 at 15:05
  • in the answer of the above question, it says reason: `Time/date stamps are logged by the framework.` which is not the case. I don't see timestamp printed by `-Xlog:gc*` – Sagar Apr 03 '19 at 15:10

1 Answers1

12

This prints date/time as well -Xlog:gc*:/opt/myapp/gc.log:time

Sagar
  • 5,315
  • 6
  • 37
  • 66