Skip to content

Access to request, as well as response headers when response status != 2XX #396

Closed

Description

@colsson11

Hi there,

I would like to be able to log the full request, including headers, in addition to response, when a response returns something other than 2XX, to be able to fully debug what is going on.

I can turn on logging, but as far as I can tell in feign.SynchronousMethodHandler , it's not possible to get it to only log in the case of failed requests. Logging all requests will mean a lot of noise.

Another option would be if the errorDecoder method feign.codec.ErrorDecoder.decode got the request passed in as well, so this could be used in a custom ErrorDecoder. A potential difficulty here would be to make this backwards compatible.

Are you open for a pull request addressing this in either way above, or maybe there is some way to achieve this that I've overlooked?

Cheers,

Christian

Activity

  1. codefromthecrypt commented on May 25, 2016

    @codefromthecrypt

    This topic has come up a few times, and usually ends when I ask someone to review the history first :)

    Have a look through #290? If you can take the conversation forward with that in mind.. all ears!

  2. colsson11 commented on Jun 2, 2016

    @colsson11
    Author

    Thanks Adrian, #290 sounds reasonable as far as I understand it.

    But what about changing the signature of feign.codec.ErrorDecoder.decode to Exception decode(Request request, Response response); ? Then implementors would have access to the full request for e.g. logging purposes, or using in a resulting exception.
    I think it should be possible to do this in a backwards compatible fashion in Java 8, with the use of a default forwarding implementation of the original method, but it seems like the source version is at 1.6 currently..

  3. codefromthecrypt commented on Jun 3, 2016

    @codefromthecrypt
  4. colsson11 commented on Jun 10, 2016

    @colsson11
    Author

    Thanks, yeah I guess when the times comes for a major version upgrade, either of these would be nice :)

  5. spencergibb commented on Jun 10, 2016

    @spencergibb
    Contributor

    fwiw, spring cloud won't move to java 8 until spring 5 and boot 2

  6. davejwilson commented on Sep 23, 2016

    @davejwilson

    is this still a limitation of feign?

  7. spencergibb commented on Oct 5, 2016

    @spencergibb
    Contributor
  8. kdavisk6 commented on Jul 20, 2018

    @kdavisk6
    Member

    see #744 for an update on this. The Request will be available, albeit sans body, on the Response.

  9. added
    enhancementFor recommending new capabilities
    help wantedIssues we need help with tackling
    documentationIssues that require updates to our documentation
    on Sep 14, 2018
  10. kdavisk6 commented on May 28, 2019

    @kdavisk6
    Member

    Closed via #744

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationIssues that require updates to our documentationenhancementFor recommending new capabilitieshelp wantedIssues we need help with tackling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions