feign
feign copied to clipboard
Log HTTP body, not headers
It could be useful to allow logging of HTTP body but not headers.
In some cases, headers contains restricted / confidential information such as usernames, passwords, tokens, so you don't want to write them to logs. Whilst HTTP body could contribute useful information.
Actually feign.Logger
doesn't have a feign.Logger.Level
allowing to configure logging of HTTP body but not headers.
To do that you could create feign.Logger
subclass, and rewrite logRequest
and logAndRebufferResponse
methods.
Hi!
Try to use https://github.com/OpenFeign/feign/blob/1c5c6e1e701742dc58ed805799ec59921320624d/core/src/main/java/feign/Logger.java#L52 and https://github.com/OpenFeign/feign/blob/1c5c6e1e701742dc58ed805799ec59921320624d/core/src/main/java/feign/Logger.java#L62 to hide sensitive data.
Thanks @radio-rogal for reply.
Yes, this alternative is useful for not logging some headers (or all of them), but it loops through all headers and you must create a feign.Logger
subclass to specify this.
It would be great to have a feign.Logger.Level
to log body but not headers.