Feign Client Logging and connection timeout

Upasana | July 14, 2020 | 2 min read | 2,830 views

we will cover how to enable network http request logging, connection timeout, read timeout for requests generated by feign Clients in Spring Boot applications.

Logging levels

Feign provides the following logging levels for debugging/troubleshooting purpose:


No logging. This is the default behaviour.


Log only the request method and URL and the response status code and execution time.


Log the basic information along with request and response headers.


Log the headers, body, and metadata for both requests and responses.

There are two ways we can configure the logging level for feign clients - using properties and using java configuration. Lets discuss them both, one by one.

The very first step is to enable DEBUG logging for FeignClient in spring boot application properties.

logging.level.package-path.FooClient: DEBUG

Logging will not work without this configuration.

Using application properties

Using application.yml, we can configure different attributes for feign client - at individual level or at global default level.

application.yml - Per Feign client configuration
      name_of_your_feign_client:  (1)
        connectTimeout: 5000
        readTimeout: 5000
        loggerLevel: basic
1 This is the name of the Feign Client

If we want to set it across feign clients, we can configure default settings using following configuration:

application.yml - Default Feign client configuration
      default:  (1)
        connectTimeout: 5000
        readTimeout: 5000
        loggerLevel: basic
1 This setting will be used as default settings across feign clients.

Using Java Configuration

We can achieve the same thing using Java Configuration, all we need to do is to create a Configuration with Bean of type Logger.Level

class FeignConfig {

    fun feignLoggerLevel(): Logger.Level {
        return Logger.Level.FULL

Now we can use the feign config in Feign Client annotation, as show below.

@FeignClient(value = "foo-client", url = "http://foo-bar.url", configuration = [FeignConfig::class])
interface FooClient {

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


Top articles in this category:
  1. Feign exception handling in Spring Cloud
  2. Feign RequestInterceptor in Spring Boot
  3. Retrofit vs Feign for Server Side
  4. How does Session handling works in Servlet environment
  5. Invoking AWS Lambda from a Java Client
  6. Java 8 date time JSON formatting with Jackson
  7. Disable SSL verification in Spring WebClient

Recommended books for interview preparation:

Find more on this topic:
Buy interview books

Java & Microservices interview refresher for experienced developers.