Actually Java has nowadays nanosecond precision in java.time.Instant, and later 
Java versions have more than millisecond precision there.

https://stackoverflow.com/questions/59632635/create-actual-date-in-string-format-from-microseconds-with-precision-of-microsec

-Harri

-----Original Message-----
From: Mark Thomas <ma...@apache.org> 
Sent: perjantai 12. syyskuuta 2025 13.46
To: users@tomcat.apache.org
Subject: Re: Support for microsecond precision in timestamps (Tomcat 9.0.108 / 
10.1.44)

On 12/09/2025 09:02, Poojashree Prakash wrote:
> Hello,
> 
> I am working with Tomcat 9.0.108 and 10.1.44 and trying to configure 
> my logging to include timestamps with microsecond precision.
> 
> I have configured the pattern to use - 
> %{yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'}t

Where in the docs suggests that that will work? "S" is millisecond so "SSSSSS" 
is going to do strange things.

> However, when I look at the logs, I notice that the values in  the 
> microsecond portion appear to be dummy/filler values rather than true
> microseconds:
> 
> {"time":"2025-09-12T05:53:05.*000*655ZUTC"}
> {"time":"2025-09-12T05:53:05.*000*675ZUTC"}

See above.

> Does Tomcat (9.0.x or 10.1.x) currently support real microsecond 
> precision in access logs or log4j2 output, or are these values 
> truncated/padded from millisecond resolution?

You can have request processing time in nanoseconds if you want (see
ExtendedAccessLogValve) but not absolute time.

> If not supported, is there a recommended approach or an upcoming plan 
> to enable true microsecond precision in timestamps for Tomcat logs?

Given that Java can't return the current time in anything more precise than 
milliseconds I don't see how microsecond precision could be realistically 
implemented.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to