feign icon indicating copy to clipboard operation
feign copied to clipboard

Separate fully logging for requests and responses

Open akileev opened this issue 6 years ago • 6 comments

I have M2M service that makes small requests and receives huge responses. I need to fully log requests and only headers for responses.

For example:

[SendsStuff#login] ---> POST http://localhost:8080/ HTTP/1.1
[SendsStuff#login] Content-Length: 80
[SendsStuff#login] Content-Type: application/json
[SendsStuff#login] 
[SendsStuff#login] {"customer_name": "netflix", "user_name": denominator", "password": "password"}
[SendsStuff#login] ---> END HTTP (80-byte body)
[SendsStuff#login] <--- HTTP/1.1 200 OK ([0-9]+ms)
[SendsStuff#login] content-length: 3
[SendsStuff#login] <--- END HTTP (3-byte body)

akileev avatar Apr 10 '19 03:04 akileev

@akileev

Thanks for raising this issue. There are two log levels available that may be applicable to your situation. First is HEADERS, which logs the Request and Response headers. Next is FULL which should log the full Request and Response. If I understand your request, you are looking for the behavior of FULL logging without Response information.

The Logger abstraction follows the same principles a Commons Logging and other log frameworks, with a series of increasing levels that add more context as you down (or in our case up) in level. To achieve what you are asking, we will probably need a new Log Level. We typically do not add new features that have been requested only once. If others are interested in this feature, please vote and we'll consider it.

kdavisk6 avatar Apr 10 '19 12:04 kdavisk6

+1 I am voting here because @kdavisk6 mentioned in the ticket https://github.com/OpenFeign/feign/issues/1035, requested functionality will be implemented under this ticket.

It's very important to have request and response to be logged in the same log instead of several logs.

sachingorade avatar Oct 25 '19 13:10 sachingorade

+1

I am voting for aggregating logs of a single request-response in one message/log entry because it unnecessarily creates noise in the logs and is not very flexible to analyze.

mbarve31 avatar Nov 18 '19 21:11 mbarve31

+1

leshkasmirnov avatar Mar 05 '20 08:03 leshkasmirnov

+1

dmku avatar Sep 28 '20 09:09 dmku

+1

svetlana-nikitina avatar Aug 31 '23 19:08 svetlana-nikitina