Skip to content

Commit

Permalink
logging response
Browse files Browse the repository at this point in the history
  • Loading branch information
manuraf committed Feb 23, 2024
1 parent 947c9e1 commit f7f1f88
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import java.io.IOException;

@Provider
public class CustomClientLoggingFilter implements ResteasyReactiveClientRequestFilter {
public class CustomClientRequestLoggingFilter implements ResteasyReactiveClientRequestFilter {

private static final Logger LOG = Logger.getLogger(CustomClientLoggingFilter.class);
private static final Logger LOG = Logger.getLogger(CustomClientRequestLoggingFilter.class);

@Override
public void filter(ClientRequestContext requestContext) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package it.pagopa.selfcare.onboarding.filter;


import jakarta.ws.rs.client.ClientRequestContext;
import jakarta.ws.rs.client.ClientResponseContext;
import jakarta.ws.rs.ext.Provider;
import org.jboss.logging.Logger;
import org.jboss.resteasy.reactive.client.spi.ResteasyReactiveClientRequestContext;
import org.jboss.resteasy.reactive.client.spi.ResteasyReactiveClientResponseFilter;

@Provider
public class CustomClientResponseLoggingFilter implements ResteasyReactiveClientResponseFilter {

private static final Logger LOG = Logger.getLogger(CustomClientResponseLoggingFilter.class);

@Override
public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) {
ResteasyReactiveClientResponseFilter.super.filter(requestContext, responseContext);
}

@Override
public void filter(ResteasyReactiveClientRequestContext requestContext, ClientResponseContext responseContext) {
String endpoint = requestContext.getUri().getPath();
String method = requestContext.getMethod();
int status = responseContext.getStatus();
LOG.infof("Response: method: %s, endpoint: %s, status [%d]", method, endpoint, status);

}
}

0 comments on commit f7f1f88

Please sign in to comment.