0

I'm trying to produce logging for Netty Reactor and finding it very hard to get what I want. The wiretap functionality has much of the information that I need, but the content is messy and spread across multiple lines which would become very confused in a production environment.

Netty Wiretap Output at INFO level includes all of the handshaking with the proxy server, etc. At its heart I see this:

REQUEST

2023-08-03 17:02:48,474 [reactor-http-nio-1] INFO reactor.netty.http.client.HttpClient:99 - [9f3f80fb-1, L:/111.22.33.44:1234 - R:proxy.mycompany.com/33.44.55.22:8080] WRITE: 480B POST /api/trying/to/call HTTP/1.1
connection:close
user-agent: ReactorNetty/1.1.9
host: target.server.com
Accept: application/json
Content-Type: application/json
content-length: 199

{"key1": "value1", "key2": "value2"}

This isn't so bad, although I would like to clean it up a bit. At least everything gets written at once. The bigger problem is the response.

RESPONSE

2023-08-03 17:02:51,122 [reactor-http-nio-1] INFO reactor.netty.http.client.HttpClient:99 - [9f3f80fb-1, L:/111.22.33.44:1234 - R:proxy.mycompany.com/33.44.55.22:8080] READ: 623B HTTP/1.1 200
Date: Thu, 03 Aug 2023 21:02:51 GMT
Content-Type: application/json
Content-Length: 793
More-headers: snipped

2023-08-03 17:02:51,125 [reactor-http-nio-1] INFO reactor.netty.http.client.HttpClient:99 - [9f3f80fb-1, L:/111.22.33.44:1234 - R:proxy.mycompany.com/33.44.55.22:8080] READ COMPLETE

2023-08-03 17:02:51,128 [reactor-http-nio-1] INFO reactor.netty.http.client.HttpClient:99 - [9f3f80fb-1, L:/111.22.33.44:1234 - R:proxy.mycompany.com/33.44.55.22:8080] READ: 793B {"key1": "value1", "key2":"value2"}

I need all of this together. If you notice this is three separate log entries. It's easy enough to read like this, but in a production environment with many concurrent requests, trying to keep these correlated will be a much greater challenge.

Does anybody have a suggestion how to capture the whole response together?

Steve
  • 692
  • 1
  • 7
  • 18
  • 1
    you can try writing your own log handler https://stackoverflow.com/a/58050657/175554 or you can group by those logs by their spanid [check](https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-spanid) – ozkanpakdil Aug 06 '23 at 09:20

0 Answers0