swagger-api / swagger-api/swagger-codegen
[JAVA] library `feign`: How to add Feign Client Logging in SpringBoot through Application Properties?
Open
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
- I Can't get logging to work with SpringBoot's properties
Description
Desired Way:
- I created a client using the Swagger-Gen using
lang=javaandlibrary=feign. I got the Invoker, model and api packages and I'm trying to get the logging in the Interface as follows: - https://cloud.spring.io/spring-cloud-netflix/multi/multi_spring-cloud-feign.html#_feign_logging
logging:
level:
platform.client.parkingplus.api.ServicoPagamentoTicket2Api: DEBUG
feign:
client:
config:
default:
loggerLevel: FULL
Wokaround
- I could get it to work by creating a bean, but that's too evasive... I would not be able to change from SpringBoot's application.properties without a hack.
@Bean
public ServicoPagamentoTicket2Api ticketApi() {
ApiClient client = new ApiClient();
// https://stackoverflow.com/questions/42751269/feign-logging-not-working/59651045#59651045
client.getFeignBuilder().logLevel(Level.HEADERS);
client.setBasePath(properties.getHost());
// Generated from swagger: https://demonstracao.parkingplus.com.br/servicos
return client.buildClient(ServicoPagamentoTicket2Api.class);
}
Swagger-codegen version
v2.4.17
Swagger declaration file content or url
- A working version of the swagger API from a service
Command line used for generation
Using the Maven Plugin
Steps to reproduce
- Generate the example from the repo with the params described
Related issues/PRs
- Not sure
Suggest a fix/enhancement
- Add instructions in the README on how to achieve it...
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 with the generated Java Feign example and its README, then compare the documented Spring Boot application properties with the bean-based workaround shown here. Document the supported configuration path for Feign client logging, and verify it against an example generated with the Maven plugin and Swagger-codegen v2.4.17.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- api, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100