Class JBossLoggingAccessLogReceiver
java.lang.Object
io.quarkus.vertx.http.runtime.filters.accesslog.JBossLoggingAccessLogReceiver
- All Implemented Interfaces:
AccessLogReceiver
Access log receiver that logs messages at INFO level via JBoss Logging.
When logMessage(String, RoutingContext) is called, structured request
fields are injected into the MDC (backed by Vert.x context-local data when running
on a Vert.x thread) under reserved keys (all prefixed with "__access__")
so that log formatters such as quarkus-logging-json can emit them as
first-class JSON fields. The MDC entries are removed synchronously in a
finally block after the log record is created, so they never leak
beyond the log call.
- Author:
- Stuart Douglas
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringMDC key for the number of bytes sent (excluding HTTP headers).static final StringPrefix shared by every MDC key written by this receiver.static final StringMDC key for the HTTP request method (e.g.static final StringMDC key for the HTTP protocol version (e.g.static final StringMDC key for the remote IP address of the client.static final StringMDC key for the response time in milliseconds.static final StringMDC key for the HTTP response status code (e.g.static final StringMDC key for the request URI, including the query string when present. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidlogMessage(String message) voidlogMessage(String message, io.vertx.ext.web.RoutingContext exchange) Log the access-log line and populate the thread-local MDC with structured request/response fields for the duration of the logging call.
-
Field Details
-
MDC_FIELD_PREFIX
Prefix shared by every MDC key written by this receiver. Consumers (e.g. logging-json) can use this prefix to discover and process structured access-log fields.- See Also:
-
MDC_METHOD
MDC key for the HTTP request method (e.g.GET).- See Also:
-
MDC_URI
MDC key for the request URI, including the query string when present.- See Also:
-
MDC_STATUS
MDC key for the HTTP response status code (e.g.200).- See Also:
-
MDC_RESPONSE_TIME_MS
MDC key for the response time in milliseconds.- See Also:
-
MDC_BYTES_SENT
MDC key for the number of bytes sent (excluding HTTP headers).- See Also:
-
MDC_REMOTE_IP
MDC key for the remote IP address of the client.- See Also:
-
MDC_PROTOCOL
MDC key for the HTTP protocol version (e.g.HTTP/1.1).- See Also:
-
DEFAULT_CATEGORY
- See Also:
-
-
Constructor Details
-
JBossLoggingAccessLogReceiver
-
JBossLoggingAccessLogReceiver
public JBossLoggingAccessLogReceiver()
-
-
Method Details
-
logMessage
- Specified by:
logMessagein interfaceAccessLogReceiver
-
logMessage
Log the access-log line and populate the thread-local MDC with structured request/response fields for the duration of the logging call.- Specified by:
logMessagein interfaceAccessLogReceiver- Parameters:
message- the pre-formatted access log lineexchange- the Vert.x routing context for the completed request
-