On 9/23/25 2:59 AM, Thomas Stuefe wrote:
On Thu, 18 Sep 2025 14:57:44 GMT, Ivan Bereziuk <[email protected]> wrote:
`jcmd` provides great diagnostics but many commands lack a timestamp in their
output.
Adding a timestamp to the output of some would add value for those debugging
JVM data.
Some diagnostic commands already provide timestamps. For example `Thread.print` already
prints one of "yyyy-MM-dd HH:mm:ss" format.
Adding timestamps to all diagnostic `jcmd` commands with a non-throw-away
STDOUT.
The exceptions are:
* `VM.uptime` - command run with `-date` argument will also print a timestamp;
* `VM.system_properties` - already lists timestamp
* `Thread.dump_to_file` - the content dumped to file already has a timestamp;
* `VM.version`
Piling on...
I think this feature would be useful. I wished for this more often than not.
I think the printing should be done on the server side, not on the client side
(be it a `date` before the invocation of jcmd, or jcmd itself printing the
date), since the timestamp on the server side may be different than that of the
client jcmd.
I would prefer a timestamp in the UL "time" decoration format: Full ISO-8601,
including timezone offset. See https://openjdk.org/jeps/158 . That would also keep in
line with gc logs etc.
I am not sure we need a specific option to disable or enable this. Who would
want to disable this feature?
anyone who is parsing the output of jcmd's programmatically ... since
this change can potentially break that code
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27368#issuecomment-3323234159