Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JAVA] library feign: How to add Feign Client Logging in SpringBoot through Application Properties? #10550

Open
marcellodesales opened this issue Nov 8, 2020 · 0 comments

Comments

@marcellodesales
Copy link

marcellodesales commented Nov 8, 2020

  • I Can't get logging to work with SpringBoot's properties
Description

Desired Way:

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...
marcellodesales added a commit to super-cash/platform-services-parkinglot that referenced this issue Dec 30, 2022
Adding the support for the log level in the app properties.

* https://cloud.spring.io/spring-cloud-netflix/multi/multi_spring-cloud-feign.html#_feign_logging

Using the option with swagger-api/swagger-codegen#10550

* Default: showing the headers only
* PreProd: Showing basic request/response result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant