https://bz.apache.org/bugzilla/show_bug.cgi?id=59871

--- Comment #11 from Rainer Jung <rainer.j...@kippdata.de> ---
(In reply to Andrey Zykov from comment #7)
> java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter
> org.apache.juli.OneLineFormatter.timeFormat = yyyy-MM-dd'T'HH:mm:ss.SSSZ
> 
> But in log I get:
> 
> 2017-04-06T10:02:23.###+0200.546 INFO [main]
> org.apache.catalina.core.StandardEngine.startInternal Starting Servlet
> Engine: Apache Tomcat/8.5.12
> 
> As you can see - there are ### instead of milliseconds, and milliseconds are
> at the end of timestamp.
> 
> I've tried set TimeFormat to "EEE, d MMM yyyy HH:mm:ss Z" and get:
> Thu, 6 Apr 2017 10:06:20 +0200.842
> 
> Again - milliseconds are at the end of timestamp.

The OneLineFormatter uses a cache for formatted time stamps with seconds
granularity. That means the value formatted in the cache replaces "S" in the
original format with "#" such that we get some reuse for the formatted
patterns.

Now OneLineFormatter would need to replace the "#" characters in the results it
gets from the cache with the sub seconds fraction of the current time. At the
moment it does not do it and instead just appends them. If the format string
does not contain any "S", no "#" will show up and you do not realize.

What we could do is check whether and how many "#" chars are in the formatted
time and replace with the milliseconds. If we see exactly three "#" chars, that
would be easy to do.

If the format string only has fixed size items in front of the milliseconds,
and uses "SSS" for the milliseconds, then one could do it relatively efficient,
since we could precalculate the correct offsets.

All in all I doubt that it is worth the effort and the performance risk. Maybe
we should just document the behavior, that we do not support "S" in the
timestamp format and always append the milliseconds separated by a dot to the
end of the formatted time stamp.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to