스프링부트(2.3.7.RELEASE)의 임베디드 Undertow의 경우,

AccessLog 설정 중 응답시간 관련 설정값이 %D %T 값이 '-'으로 정상적으로 들어오지 않음

 

application.yml 설정 - Undertow AccessLog 설정은 요게 끝!

server:
   undertow:
      no-request-timeout: 60000
      accesslog:
         enabled: true
         dir: /access_log/
         pattern: '%{i,X-Forwarded-For} %l %t %r %s %b "%{i,Referer}" "%{i,User-Agent}" "%{i,GO-Agent}" %T'
         rotate: true
         prefix: access_.
         suffix: log

 

%D - Time taken to process the request, in millis

%T - Time taken to process the request, in seconds

(Tomcat의 경우, 잘만 들어오던데....)

https://kb.novaordis.com/index.php/Undertow_WildFly_Subsystem_Configuration_-_access-log

 

Undertow WildFly Subsystem Configuration - access-log - NovaOrdis Knowledge Base

Internal Overview This page documents the configuration of the Undertow AccessLogHandler. The handler generates log entries for each request. The handler can log any attributed that is provided with the ExchangeAttribute mechanism. The most common are pres

kb.novaordis.com

%D
Time taken to process the request, in milliseconds.
Note that %D won't return the request processing time, but "-" unless the http-listener's and ajp-listener's record-request-start-time is set to "true". Also see record-request-start-time.

위 내용에 따르면 %D, %T의 경우 record-request-start-time=true로 설정하라는데...

임베디드 Undertow에는 YML(또는 Properties)에 설정이 없다.

 

찾다보니...
https://gist.github.com/cdmatta/2a4536ab687bf7a92482faf031e8a0b5

 

Spring boot + Undertow access log, capture/record request processing time. Customize UndertowWebServerFactory

Spring boot + Undertow access log, capture/record request processing time. Customize UndertowWebServerFactory - UndertowAccessLogApplication.java

gist.github.com

Java 에서 설정할 수 있도록 샘플로 만들어둔 개발자분이 계심. 매우감사!!

 

PS. 같은 방법~ 다른 사이트! 추가

https://www.cnblogs.com/shareTechnologyl/articles/10757907.html

  1. rndrma 2022.06.03 15:28

    undertow 의 access_log는 시간별로 찍을순 없나요?

+ Recent posts