Search code examples
wildflyundertow

Does Undertow's Acces Log Time Indicate Request Recieve Time or Request Completion TIme?


I'm working with Undertow + JBoss, and had a question. The standard time facility will log date and time as per the javadoc on the AccessLogHandler. However, I can't find anything to indicate whether this is the time the request was received, or whether this was the time that the request was completed.

I took a peek at DateTimeAttribute, and it appears that it would be a dynamically generated statistic when readAttribute() is called. That method is called a couple dozen times in the undertow core code, but I want to believe this method is the main use in a request/response flow (found in AccessLogHandler):

    private class AccessLogCompletionListener implements ExchangeCompletionListener {
    @Override
    public void exchangeEvent(final HttpServerExchange exchange, final NextListener nextListener) {
        try {
            if(predicate == null || predicate.resolve(exchange)) {
                accessLogReceiver.logMessage(tokens.readAttribute(exchange));
            }
        } finally {
            nextListener.proceed();
        }
    }
}

So if I'm understanding this code correctly, it would appear that this timestamp is generated after the request has been completed. Can anyone confirm that this is the case?


Solution

  • It's a completion time. You can test this by noting your PC clock, doing a long request, e.g. by setting a breakpoint in your servlet or other UI code, doing a Thread.sleep(30000), and then seeing the timestamp in the access log.