I have an issue where I can not log any request/response on q/health/ready or q/health/live endpoints. I implemented already LoggingFilter to intercept all the request and responses, but doesn't work for MicroProfile health endpoints.
@Provider
public class LoggingFilter implements ContainerResponseFilter, ContainerRequestFilter, WriterInterceptor {
... implementation of other methods...
@Override
public void aroundWriteTo(WriterInterceptorContext writerInterceptorContext) throws IOException, WebApplicationException {
writerInterceptorContext.proceed();
String endpoint = (String) writerInterceptorContext.getProperty(LoggingFilter.ENDPOINT);
if (null != writerInterceptorContext.getEntity()) {
String responseBody = writerInterceptorContext.getEntity().toString();
LOG.info("response", Map.of(
"headers", writerInterceptorContext.getHeaders(),
"body", responseBody,
"endpoint", endpoint,
"requestId", writerInterceptorContext.getProperty(REQUEST_ID)));
} else {
LOG.info("response", Map.of(
"headers", writerInterceptorContext.getHeaders(),
"endpoint", endpoint,
"requestId", writerInterceptorContext.getProperty(REQUEST_ID)));
}
}