OpenFeign / OpenFeign/feign

Provide proper integration with SLF4J

Open
#738 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feign-12 proposal waiting for votes
Dominant language
Java
Stars
9.8k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
41

Description

Feign currently has it's own implementation for logging through the Logger class. This provides informative messages and configurable levels of detail about requests, from just the request method/URL & response, to including the headers, or even the entire body. This configuration applies to all requests for the client.

Feign also provides feign-slf4j which will emit those log messages via SLF4J at the debug level.

First, the slf4j integration doesn't provide any output in environments where SLF4J is set to any level less than debug (most production environments I've interacted with only log info and above).

Second, the logging is all or nothing—there is no way to see more detail for requests that result in an error.

Logging in Feign would be much more useful if it could provide output tailored to different log levels that SLF4J defines, e.g. headers at debug, request method & URL at info, retries at warn, and failures at error. This would allow users existing SLF4J configurations to tailor Feign's output as appropriate for the environment.

I do not think this can be accomplished in the existing framework provided by Logger, as it does not know what level the underlying logging implementation is configured for nor does it provide logging level information to the underlying implementation along with messages. I propose adding slf4j-api to feign-core and using it for logging throughout Feign.

I realize that this is a big request, as feign-core currently has no required dependencies, but SLF4J is incredibly widely used and its addition would prove a great utility for Feign deployments in production environments.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with core/src/main/java/feign/Logger.java and the feign-slf4j integration, then inspect feign-core's dependency configuration. The proposed work is complete when Feign logging can use SLF4J levels for request details, retries, and failures without losing the existing configurable detail levels.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design, observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.