Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify response time in logback access logs for jetty? [duplicate]

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 390
Chris Tucker Avatar asked Nov 23 '22 13:11

Chris Tucker


2 Answers

Call setLogLatency(true) on NCSARequestLog

like image 139
Tim Avatar answered Nov 26 '22 03:11

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 37
oae Avatar answered Nov 26 '22 01:11

oae