Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] How to log request time with milliseconds

Javadoc tells me that format string Must be in a format supported by DateCache.
But DateCache produces the same result for request arrived in the same second, comments in DateCache read like "Sub second formatting is not handled.".

So I can't use CustomRequestLog to produce milliseconds...
On Monday, July 24, 2023 at 05:38:26 PM GMT+3, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:


You'll need to use the CustomRequestLog class.

Know that the EXTENDED_NCSA_FORMAT is a format string that is hard coded to ...

%{client}a - %u %t "%r" %s %O  "%{Referer}i" "%{User-Agent}i

The `%t` is the time/date format.
You can specify the syntax for that format, some examples:

%{EEE MMM dd HH:mm:ss zzz yyyy}t
%{EEE MMM dd HH:mm:ss zzz yyyy|EST}t
%{EEE MMM dd HH:mm:ss zzz yyyy|JST|ja}t

These are the time/date syntax ...
1) specified with default GMT timezone, and default locale - aka TimeZone.getTimeZone("GMT") and Locale.getDefault()
2) specified with EST timezone, and default locale - TimeZone.getTimeZone("EST"), and Locale.getDefault()
3) specified with JST timezone, and `ja` locale - TimeZone.getTimeZone("JST"), and Locale.forLanguageTag("ja")

The default syntax, if unspecified by the `%t` tag is ...

dd/MMM/yyyy:HH:mm:ss ZZZ

Joakim Erdfelt / joakim@xxxxxxxxxxx


On Mon, Jul 24, 2023 at 5:48 AM jdison16--- via jetty-users <jetty-users@xxxxxxxxxxx> wrote:
Hello!

I am using AbstractNCSARequestLog with setLogDateFormat("HH:mm:ss,SSS"); to log in NCSA format with milliseconds.

Now in recent versions of Jetty this class was deleted with suggestion to use CustomRequestLog with EXTENDED_NCSA_FORMAT.

But it logs request time without millis.

Is there any simple way to log milliseconds too without writing my own CustomRequestLog with almost the same content (and delete DateCache logic).

Thanks in advance!
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

Back to the top