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`

The Thread.print dcmd already uses the yyyy-MM-dd HH:mm:ss format but yes, 
having all timestamps in a consistent format and time zone is useful for log 
comparisons. 

I'd second the global dcmd flag suggestion which would allow the option of the 
timestamp(on or off). Some commands should have timestamp on by default though. 
Those where output is sensitive to the time that the command was issued. e.g. 
Thread dumps
...and as per JBS suggestions, other examples include: (but not limited to)
GC.finalizer_info
GC.heap_info

Looking at such data output in isolation with the absence of timestamps makes 
it far less valuable IMO, especially when one wants to compare it to 
application logs, GC logs etc.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/27368#issuecomment-3318375894

Reply via email to