Spring Cloud Gateway with logs

@Bean
HttpClient httpClient() {
return HttpClient.create().wiretap("LoggingFilter", LogLevel.INFO, AdvancedByteBufFormat.TEXTUAL);
}
@Component
public class Config {

private static Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

@Autowired
HttpClientProperties properties;

@Autowired
ServerProperties serverProperties;


@Bean
HttpClientFactory httpClientFactory() {
List<HttpClientCustomizer> list = new ArrayList<>();
list.add(httpClient -> {
logger.info("Applying Logging filter to {}", httpClient);
return httpClient.wiretap("LoggingFilter", LogLevel.INFO, AdvancedByteBufFormat.TEXTUAL);
});
HttpClientFactory factory = new HttpClientFactory(properties, serverProperties, list);
return factory;
}
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store