Commit 06cdccc2 authored by shishir suman's avatar shishir suman
Browse files

adding prefilter for logging requests

parent bc03c00a
No related merge requests found
Showing with 31 additions and 0 deletions
+31 -0
package com.upsmf.gateway.filter.pre;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
@Slf4j
@Component
public class CommonPreFilter implements GlobalFilter, Ordered {
@Override
public Mono<Void> filter(
ServerWebExchange exchange,
GatewayFilterChain chain) {
log.debug("Global Pre Filter executed || Request - {} ", exchange.getRequest());
log.debug("Global Pre Filter executed || Request Headers - {} ", exchange.getRequest().getHeaders());
log.info("Global Pre Filter executed || Path - {} ", exchange.getRequest().getPath().value());
return chain.filter(exchange);
}
@Override
public int getOrder() {
return -1;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment