From 4e2b90fa56eae89b49530573bc557e1f916331e7 Mon Sep 17 00:00:00 2001 From: "Kristen.Herum" Date: Mon, 7 Oct 2024 14:43:00 +0200 Subject: [PATCH] Add logging filter for Reactor Netty HTTP client #deploy-proxy-yrkesskade Configured application.yml to set logging levels for Reactor Netty and Spring Cloud Gateway. Created a new LogFilter configuration class to add wiretap logging for HTTP client at INFO level. --- .../yrkesskadeproxy/config/LogFilter.java | 17 +++++++++++++++++ .../src/main/resources/application.yml | 9 +++++++++ 2 files changed, 26 insertions(+) create mode 100644 proxies/yrkesskade-proxy/src/main/java/no/nav/testnav/proxies/yrkesskadeproxy/config/LogFilter.java diff --git a/proxies/yrkesskade-proxy/src/main/java/no/nav/testnav/proxies/yrkesskadeproxy/config/LogFilter.java b/proxies/yrkesskade-proxy/src/main/java/no/nav/testnav/proxies/yrkesskadeproxy/config/LogFilter.java new file mode 100644 index 00000000000..49fd4860725 --- /dev/null +++ b/proxies/yrkesskade-proxy/src/main/java/no/nav/testnav/proxies/yrkesskadeproxy/config/LogFilter.java @@ -0,0 +1,17 @@ +package no.nav.testnav.proxies.yrkesskadeproxy.config; + +import io.netty.handler.logging.LogLevel; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import reactor.netty.http.client.HttpClient; +import reactor.netty.transport.logging.AdvancedByteBufFormat; + +@Configuration +public class LogFilter { + + @Bean + HttpClient httpClient() { + return HttpClient.create().wiretap("LoggingFilter", + LogLevel.INFO, AdvancedByteBufFormat.TEXTUAL); + } +} diff --git a/proxies/yrkesskade-proxy/src/main/resources/application.yml b/proxies/yrkesskade-proxy/src/main/resources/application.yml index 547d065ed7b..615d2939701 100644 --- a/proxies/yrkesskade-proxy/src/main/resources/application.yml +++ b/proxies/yrkesskade-proxy/src/main/resources/application.yml @@ -25,6 +25,15 @@ server: error: include-message: always +logging: + level: + reactor: + netty: INFO + org: + springframework: + cloud: + gateway: INFO + consumers: yrkesskade: url: http://yrkesskade-datagenerator-service.yrkesskade.svc.cluster.local