diff --git a/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/filter/CustomClientLoggingFilter.java b/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/filter/CustomClientRequestLoggingFilter.java similarity index 87% rename from apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/filter/CustomClientLoggingFilter.java rename to apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/filter/CustomClientRequestLoggingFilter.java index 20fcf42c9..4ecd5da78 100644 --- a/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/filter/CustomClientLoggingFilter.java +++ b/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/filter/CustomClientRequestLoggingFilter.java @@ -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 { diff --git a/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/filter/CustomClientResponseLoggingFilter.java b/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/filter/CustomClientResponseLoggingFilter.java new file mode 100644 index 000000000..788f44d9e --- /dev/null +++ b/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/filter/CustomClientResponseLoggingFilter.java @@ -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); + + } +}