Created
August 2, 2022 15:59
-
-
Save rafaeltuelho/db87269b04a715f34cc51da4344563a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.acme.rest.json; | |
import javax.ws.rs.container.ContainerRequestContext; | |
import javax.ws.rs.container.ContainerRequestFilter; | |
import javax.ws.rs.core.Context; | |
import javax.ws.rs.core.UriInfo; | |
import javax.ws.rs.ext.Provider; | |
import org.jboss.logging.Logger; | |
import io.vertx.core.http.HttpServerRequest; | |
@Provider | |
public class QuarkusLoggingFilter implements ContainerRequestFilter { | |
private static final Logger LOG = Logger.getLogger(LoggingFilter.class); | |
@Context | |
UriInfo info; | |
@Context | |
HttpServerRequest request; | |
@Override | |
public void filter(ContainerRequestContext context) { | |
final String method = context.getMethod(); | |
final String path = info.getPath(); | |
final String address = request.remoteAddress().toString(); | |
LOG.infof("Request %s %s from IP %s", method, path, address); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment