Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

485
Visualizações
Feign logging not working

I'm trying to get logging working for each request from a Feign rest client. However I cannot get the logging to work, while 'standard' Slf4j logging does work.

I have the following:

public MyClient() {
        initConnectionProperties();

        this.service = Feign.builder()
                .contract(new JAXRSContract())
                .decoder(getJacksonDecoder())
                .encoder(getJacksonEncoder())


                .requestInterceptor(new BasicAuthRequestInterceptor(user, password))
                //.client(new OkHttpClient())
                .logger(new Slf4jLogger(MyClient.class)) //not working

                .logLevel(feign.Logger.Level.BASIC)
                .target(MyClient.class, this.url);
        logger.info("Connection parameters: url = " + url + ", user = " + user); //Is working
    }
over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

You need to configure logging in application.properties as below:

logging.level.<package path>.MyClient=DEBUG

If you're using application.yml then:

logging.level.<package path>.MyClient: DEBUG

The log level can be set to tell Feign how much to log.

Options are:

  • NONE, No logging (DEFAULT)
  • BASIC, Log only the request method and URL and the response status code and execution time
  • HEADERS, Log the basic information along with request and response headers
  • FULL, Log the headers, body, and metadata for both requests and responses

Example:

logLevel(feign.Logger.Level.NONE)
or
logLevel(feign.Logger.Level.BASIC)
or
logLevel(feign.Logger.Level.HEADERS)
or
logLevel(feign.Logger.Level.FULL)

For more details, you can refer this

over 4 years ago · Santiago Trujillo Relatório

0

This is how i was able to log using Custom Config class

Note Feign logging only responds to the DEBUG level.

Config Class

@Configuration
public class UserClientConfig {

    @Bean
    Logger.Level feignLoggerLevel() {
        return Logger.Level.HEADERS;
    }
} 

Client

@FeignClient(name = "User", url = "http://localhost:8080",configuration=UserClientConfig.class)
public interface UserClient {

    @RequestMapping(method = RequestMethod.GET, value = "/user")
    List<User> getAllUsers();    

}

application.properties

logging.level.<pcakgepath>.UserClient: DEBUG
over 4 years ago · Santiago Trujillo Relatório

0

First you need to set the logging level for your feign client class to DEBUG, as Maverick already mentioned in his answer.

Then if you use Spring Boot, beside the option to create @Configuration classes as Niraj already mentioned in his answer, you can configure each client individually in you application properties/yml config file:

feign: client: config: the_name_of_your_feign_client: connectTimeout: 5000 readTimeout: 5000 loggerLevel: basic

Or use default instead of the_name_of_your_feign_client to configure all your feign clients in the same way:

feign: client: config: default: connectTimeout: 5000 readTimeout: 5000 loggerLevel: basic

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda