-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
.
Asked
Active
Viewed 7,000 times
7

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 Answers
12
This prints date/time as well -Xlog:gc*:/opt/myapp/gc.log:time

Sagar
- 5,315
- 6
- 37
- 66
-
4I would suggest `-Xlog:gc*:/opt/myapp/gc.log:time,level,tags` to include all the default decorators. – Dan Berindei Jan 06 '20 at 09:26