Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable response time logging in Jetty 7

Tags:

logback

jetty

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.

like image 940
Chris Tucker Avatar asked Feb 23 '11 19:02

Chris Tucker


2 Answers

Call setLogLatency(true) on NCSARequestLog

like image 166
Tim Avatar answered Oct 16 '22 09:10

Tim


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.

like image 38
oae Avatar answered Oct 16 '22 10:10

oae