Search code examples
jettylogback

How to enable response time logging in Jetty 7


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.


Solution

  • Call setLogLatency(true) on NCSARequestLog