Feign Client Logging

In this tutorial you will learn how to enable Feign Client Logging.

To learn how to add Feign Client to your project and how to use it to call another Microservice, please follow this tutorial: Feign Client to Call Another Microservice

For a step by step series of video lessons, please check this page: Spring Boot Microservices and Spring Cloud.

Enable Logging in Application Properties File

To enable Feign Client logging you will need to update an application.properties file of your project with a new property.

logging.level.<full class name of the interface here> = DEBUG

The logger is created for each Feign Client. If the name of my Feign client interface is “AlbumsServiceClient” and it is located in the package “com.appsdeveloperblog.photoapp.api.users.data” then the complete class name I need to provide in my property file is: “com.appsdeveloperblog.photoapp.api.users.data.AlbumsServiceClient“. For example:

logging.level.com.appsdeveloperblog.photoapp.api.users.data.AlbumsServiceClient=DEBUG

Configure Feign Logger Level

The default logger level of Feign Client is NONE. So if you want to see something meaningful appear in your console, update the default logger level from NONE to one of these options:

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

To configure the logger level create a Logger.Level Bean. For example:

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class PhotoAppApiApplication {

    public static void main(String[] args) {
        SpringApplication.run(PhotoAppApiApplication.class, args);
    }

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

}

Video Lessons

If you are interested in learning more about Spring Cloud and Microservices, please have a look at this video course: Spring Boot Microservices and Spring Cloud.

There are other online video courses that teach Spring Cloud and Microservices. Have a look at the below list.