All,

On 9/26/25 10:48 AM, Harri Pesonen wrote:
Java 8 has already Instant with nanosecond precision but in practice
the digits are all zeros after millisecond.

Personally I would prefer the change in 10.1.x only (we use Tomcat
9).
I seem to recall that on certain versions of Microsoft Windows + Java, even the milliseconds are sometimes truncated to some arbitrary precision that is *not* as fine as milliseconds.

It appears that System.nanoTime is always at least as good as System.currentTimeMillis on every platform, and can even give you better results when only reporting milliseconds precision based upon the type of system clock being consulted by each of those calls from Java.

-chris

-----Original Message-----
From: Michael Osipov <[email protected]>
Sent: perjantai 26. syyskuuta 2025 14.58
To: [email protected]
Subject: Re: Possible access log changes for 9.0.x - nanoseconds - feedback 
request

On 2025/09/24 14:25:29 Mark Thomas wrote:
All,

You may have seen the request for nanosecond precision in the access
log. The Tomcat committers are currently looking at implementing this.

For 10.1.x onwards, it is relatively simple because nearly all the
internal and public APIs for access log timing already use nanoseconds.

9.0.x is trickier because all the internal and public APIs for access
logs expect timing information in milliseconds. (There was a breaking
change in 10.0.x that switched this to nanoseconds.)

There 3 options.

1. Don't implement nanosecond precision for access logs in 9.0.x.

2. Back-port the breaking change from 10.1.x to 9.0.x and switch
everything to nanoseconds. Any custom code that expects milliseconds
will break.

3. Back-port a more complex/invasive change which adds nanosecond
support but shouldn't (if I got it right) break any custom code that
expects milliseconds.

You can see how complex the changes are in this PR:
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
ub.com%2Fapache%2Ftomcat%2Fpull%2F901&data=05%7C02%7Charri.pesonen%40s
inch.com%7Cdb40378cee8a47daafeb08ddfcf429b1%7C3b518aae89214a7b8497619d
756ce20e%7C0%7C0%7C638944847779791345%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0
eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIl
dUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=HK3MDjLfr68GTgSneK08ggg1YQ92JQe%2BFj
WFGgYunCo%3D&reserved=0

Option 2 only requires the first commit. Option 3 requires both.

The Tomcat committers would appreciate feedback from the user
community as to which option they prefer.

Feedback either here or on the PR is fine.

There is a larger question to this: I do remember that some JVM versions on 
some platforms weren't able to resolve to nanoseconds, even if you have 
requested it. Would this apply to 9 with JVM 8?

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to