swagger-api / swagger-api/swagger-codegen

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

Open
#10,550 0 comments 0 reactions 0 assignees View on GitHub

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:

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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.