Apache and Tomcat both make it easy to log response times out to the server access log (with the %D pattern), but I've been unable to find any equivalent support in Jetty, either with the default NCSARequestLog
or using logback-access (my preferred logging setup).
Is there a way of getting Jetty to log these times? I could see it being possible to use a custom handler of some kind to gather this information and make it available to the logging handler, but am hopeful that something like the StatisticsHandler
could do it for me as it's clearly already tracking this information to generate its aggregate stats.
Call setLogLatency(true)
on NCSARequestLog
A good detailed explanation on how to enable response time logging through configuration is here: Monitoring latency in Jetty request log
Summary:
Open [JETTY HOME]/etc/jetty.xml.
Locate <Ref id=”RequestLog”> section.
Add Set name=”logLatency”>true to setter list.
Save it and restart Jetty.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With