spring-cloud / spring-cloud/spring-cloud-openfeign
Allow configuring shouldLogRequestHeader/shouldLogResponseHeader
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 838
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 13
Description
**Suppressing specific headers is cumbersome **
Certain headers should probably not be logged, e.g., Authorization.
Add configuration properties to include/exclude headers
Add the following list configurations:
spring.cloud.openfeign.client.config.name.headers.request.includespring.cloud.openfeign.client.config.name.headers.request.excludespring.cloud.openfeign.client.config.name.headers.response.includespring.cloud.openfeign.client.config.name.headers.response.exclude
The expected behavior would be to exclude any header in the exclude list, and only show header in the include list if any are present.
Alternatives: Making a custom component
@Component
class MyFeignLoggerFactory implements FeignLoggerFactory {
@Override
public Logger create(Class<?> type) {
return new Slf4jLogger(type) {
@Override
protected boolean shouldLogRequestHeader(String header) {
return !"Authorization".equals(header);
}
};
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing shouldLogRequestHeader and shouldLogResponseHeader methods and the Spring Cloud OpenFeign client configuration entry points. Add the four request and response include/exclude properties, then verify that excluded headers are omitted and that an include list limits logged headers when present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 57/100