I can configure Jetty to log request latency https://support.lucidworks.com/s/question/0D58000003LRo9YCAT/how-to-log-http-request-latencies-for-solr-in-jetty-logs
<Ref id="Handlers">
<Call name="addHandler">
<Arg>
<New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
<Set name="filename">
logs/request.yyyy_mm_dd.log
</Set>
<Set name="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">false</Set>
<Set name="logCookies">false</Set>
<Set name="LogTimeZone">UTC</Set>
<Set name="logLatency">true</Set>
</New>
</Set>
</New>
</Arg>
</Call>
</Ref>
However this goes to a separate log file, and log4j isn't used, so the application insights log4j appender doesn't pick it up. (See - Solr to Application Insights)
How can I get log4j to record jetty request latency?
Alternatively, I see that logback has built in support for it's own RequestLogImpl https://logback.qos.ch/access.html
And application insights supports logback https://docs.microsoft.com/en-us/azure/azure-monitor/app/java-trace-logs
<Ref id="Handlers">
<Call name="addHandler">
<Arg>
<New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler">
<Set name="requestLog">
<New id="requestLogImpl" class="ch.qos.logback.access.jetty.RequestLogImpl">
</New>
</Set>
</New>
</Arg>
</Call>
</Ref>
server\lib\ext\logback-access-1.2.3.jar
server\lib\ext\logback-core-1.2.3.jar
However, I can't seem to get logback to log any requests to a file. Not sure it's picking up the logback-access.xml configuration, tried supplying the file path, using the default, but no luck.
server\etc\logback-access.xml (same location at jetty.xml)
and tried specifying relative, fully qualified paths to log file location, but none have worked.
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<!-- always a good activate OnConsoleStatusListener -->
<statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>C:\logcallback\access.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>C:\logcallback\access.%d{yyyy-MM-dd}.log.zip</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>combined</pattern>
</encoder>
</appender>
<logger name="org.eclipse.jetty.server.RequestLog" level="DEBUG" additivity="false">
<appender-ref ref="FILE" />
</logger>
<root level="DEBUG">
<appender-ref ref="FILE"/>
</root>
</configuration>
So how can I get Solr to log Jetty Request latency metrics to application insights, using either log4j or logback?