Feign has out of box logging mechanism and it can be achieved through simple steps.

If you are using spring-cloud-starter-feign

Feign using Slf4jLogger for logging.Feign logging documentation

As per doc, the below logging levels are available to configure,

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

Injecting the Logger.Level bean is enough.

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

OR

If you prefer using configuration properties to configured all @FeignClient, you can create configuration properties with default feign name.

feign:
  client:
    config:
      default:
        loggerLevel: basic

of if you are using a newer version (Spring Boot 3) the config will be like:

spring:
  cloud:
    openfeign:
      client:
        config:
          default:
            loggerLevel: full

If you are using 'io.github.openfeign:feign-core'

If you are constructing the Feign builder then you can mention logLevel(Level.BASIC) as

Feign.builder()
    .logger(new Slf4jLogger())
    .logLevel(Level.BASIC)
    .target(SomeFeignClient.class, url);

We have the flexibility to customize the logging message

The default feign request and response logging

Request logging

Resopnse logging

we can customize the feign request, response logging pattern by overriding Logger#logRequest and Logger#logAndRebufferResponse methods. In the following example, we have customized request logging pattern

log(configKey, "---> %s %s HTTP/1.1 (%s-byte body) ", request.httpMethod().name(), request.url(), bodyLength);

and response logging pattern

log(configKey, "<--- %s %s HTTP/1.1 %s (%sms) ", request.httpMethod().name(), request.url(), status, elapsedTime);

The Full example is


import feign.Logger;
import feign.Request;
import feign.Response;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;

import static feign.Logger.Level.HEADERS;

@Slf4j
public class CustomFeignRequestLogging extends Logger {

    @Override
    protected void logRequest(String configKey, Level logLevel, Request request) {

        if (logLevel.ordinal() >= HEADERS.ordinal()) {
            super.logRequest(configKey, logLevel, request);
        } else {
            int bodyLength = 0;
            if (request.requestBody().asBytes() != null) {
                bodyLength = request.requestBody().asBytes().length;
            }
            log(configKey, "---> %s %s HTTP/1.1 (%s-byte body) ", request.httpMethod().name(), request.url(), bodyLength);
        }
    }

    @Override
    protected Response logAndRebufferResponse(String configKey, Level logLevel, Response response, long elapsedTime)
            throws IOException {
        if (logLevel.ordinal() >= HEADERS.ordinal()) {
            return super.logAndRebufferResponse(configKey, logLevel, response, elapsedTime);
        } else {
            int status = response.status();
            Request request = response.request();
            log(configKey, "<--- %s %s HTTP/1.1 %s (%sms) ", request.httpMethod().name(), request.url(), status, elapsedTime);
            return response;   
        }        
    }


    @Override
    protected void log(String configKey, String format, Object... args) {
        log.debug(format(configKey, format, args));
    }

    protected String format(String configKey, String format, Object... args) {
        return String.format(methodTag(configKey) + format, args);
    }
}

NOTE: Request payload can be easily logged through

String bodyText =
              request.charset() != null ? new String(request.body(), request.charset()) : null;

but be careful writing the response payload after you are reading the input stream Util.toByteArray(response.body().asInputStream()) then you have to construct the response again like response.toBuilder().body(bodyData).build(). Otherwise, you will end up with the expection. The reason is response streams are read and always closed before returning, thats why the method is named as logAndRebufferResponse

How to use the custom CustomFeignRequestLogging?

If you are building feign client using just 'io.github.openfeign:feign-core'

Feign.builder()
     .logger(new CustomFeignRequestLogging())
     .logLevel(feign.Logger.Level.BASIC);

If you are using 'org.springframework.cloud:spring-cloud-starter-openfeign'

@Configuration
public class FeignLoggingConfiguration {

    @Bean
    public CustomFeignRequestLogging customFeignRequestLogging() {
        return new CustomFeignRequestLogging();
    }

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

Answer from Prasanth Rajendran on Stack Overflow
🌐
Baeldung
baeldung.com › home › spring › spring boot › feign logging configuration
Feign Logging Configuration | Baeldung
February 26, 2025 - Feign client logging helps us to have a better view of the requests that have been made. To enable logging, we need to set the Spring Boot logging level to DEBUG for the class or package that contains our feign client in the application.properties ...
Top answer
1 of 6
83

Feign has out of box logging mechanism and it can be achieved through simple steps.

If you are using spring-cloud-starter-feign

Feign using Slf4jLogger for logging.Feign logging documentation

As per doc, the below logging levels are available to configure,

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

Injecting the Logger.Level bean is enough.

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

OR

If you prefer using configuration properties to configured all @FeignClient, you can create configuration properties with default feign name.

feign:
  client:
    config:
      default:
        loggerLevel: basic

of if you are using a newer version (Spring Boot 3) the config will be like:

spring:
  cloud:
    openfeign:
      client:
        config:
          default:
            loggerLevel: full

If you are using 'io.github.openfeign:feign-core'

If you are constructing the Feign builder then you can mention logLevel(Level.BASIC) as

Feign.builder()
    .logger(new Slf4jLogger())
    .logLevel(Level.BASIC)
    .target(SomeFeignClient.class, url);

We have the flexibility to customize the logging message

The default feign request and response logging

Request logging

Resopnse logging

we can customize the feign request, response logging pattern by overriding Logger#logRequest and Logger#logAndRebufferResponse methods. In the following example, we have customized request logging pattern

log(configKey, "---> %s %s HTTP/1.1 (%s-byte body) ", request.httpMethod().name(), request.url(), bodyLength);

and response logging pattern

log(configKey, "<--- %s %s HTTP/1.1 %s (%sms) ", request.httpMethod().name(), request.url(), status, elapsedTime);

The Full example is


import feign.Logger;
import feign.Request;
import feign.Response;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;

import static feign.Logger.Level.HEADERS;

@Slf4j
public class CustomFeignRequestLogging extends Logger {

    @Override
    protected void logRequest(String configKey, Level logLevel, Request request) {

        if (logLevel.ordinal() >= HEADERS.ordinal()) {
            super.logRequest(configKey, logLevel, request);
        } else {
            int bodyLength = 0;
            if (request.requestBody().asBytes() != null) {
                bodyLength = request.requestBody().asBytes().length;
            }
            log(configKey, "---> %s %s HTTP/1.1 (%s-byte body) ", request.httpMethod().name(), request.url(), bodyLength);
        }
    }

    @Override
    protected Response logAndRebufferResponse(String configKey, Level logLevel, Response response, long elapsedTime)
            throws IOException {
        if (logLevel.ordinal() >= HEADERS.ordinal()) {
            return super.logAndRebufferResponse(configKey, logLevel, response, elapsedTime);
        } else {
            int status = response.status();
            Request request = response.request();
            log(configKey, "<--- %s %s HTTP/1.1 %s (%sms) ", request.httpMethod().name(), request.url(), status, elapsedTime);
            return response;   
        }        
    }


    @Override
    protected void log(String configKey, String format, Object... args) {
        log.debug(format(configKey, format, args));
    }

    protected String format(String configKey, String format, Object... args) {
        return String.format(methodTag(configKey) + format, args);
    }
}

NOTE: Request payload can be easily logged through

String bodyText =
              request.charset() != null ? new String(request.body(), request.charset()) : null;

but be careful writing the response payload after you are reading the input stream Util.toByteArray(response.body().asInputStream()) then you have to construct the response again like response.toBuilder().body(bodyData).build(). Otherwise, you will end up with the expection. The reason is response streams are read and always closed before returning, thats why the method is named as logAndRebufferResponse

How to use the custom CustomFeignRequestLogging?

If you are building feign client using just 'io.github.openfeign:feign-core'

Feign.builder()
     .logger(new CustomFeignRequestLogging())
     .logLevel(feign.Logger.Level.BASIC);

If you are using 'org.springframework.cloud:spring-cloud-starter-openfeign'

@Configuration
public class FeignLoggingConfiguration {

    @Bean
    public CustomFeignRequestLogging customFeignRequestLogging() {
        return new CustomFeignRequestLogging();
    }

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

2 of 6
13

The accepted answer did not work for me until I added the following settings to my application.yml file:

logging:
  level:
    com:
      mypackage1:
        mysubackage1:
          mysubpackage2: DEBUG
🌐
Medium
medium.com › @reetesh043 › handling-logging-in-spring-boot-feignclient-a-complete-guide-0831676b8526
Handling Logging in Spring Boot FeignClient: A Complete Guide | by Reetesh Kumar | Medium
August 5, 2025 - This post shows you how to enable and customize FeignClient logging in Spring Boot, with working code snippets and configuration examples. Feign abstracts away HTTP calls. That’s great for cleaner code. But it also means you don’t see raw HTTP requests or responses unless you explicitly log them.
🌐
Spring Cloud
cloud.spring.io › spring-cloud-openfeign › 2.2.x › reference › html
Spring Cloud OpenFeign
The Logger.Level object that you may configure per client, tells Feign how much to log. Choices 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.
🌐
Mayukh Datta
thecoducer.com › 2023 › 03 › custom-logger-configuration-for-feign-clients
Custom Logger Configuration for Feign Clients · Mayukh Datta
March 26, 2023 - */ } @Override protected Response logAndRebufferResponse( String configKey, Level logLevel, Response response, long elapsedTime) { int status = response.status(); Request request = response.request(); String responseString = ""; Response clonedResponse = response.toBuilder().build(); if (Objects.nonNull(response.body())) { try { byte[] bodyData = Util.toByteArray(response.body().asInputStream()); Response.Body responseBodyCopy = response.toBuilder().body(bodyData).build().body(); clonedResponse = response.toBuilder().body(responseBodyCopy).build(); responseString = StringUtil.toString(response
🌐
Javacodemonk
javacodemonk.com › feign-client-logging-and-connection-timeout-spring-boot-60b8826d
Feign Client Logging and connection timeout
July 14, 2020 - ... 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.
🌐
Apps Developer Blog
appsdeveloperblog.com › home › spring framework › spring cloud › feign client logging
Feign Client Logging - Apps Developer Blog
November 9, 2022 - FULL, Log the headers, body, and metadata for 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; } }
🌐
Medium
medium.com › @somarouthu.sivaprasads › spring-cloud-feign-858c225e2341
Spring Cloud Feign. Logging: | by SivaprasadS | Medium
March 15, 2019 - class CustomFeignLogger extends Slf4jLogger { @Override protected void logRequest(String configKey, Level logLevel, Request request) { FeignRequest feignRequest = new FeignRequest(); feignRequest.setMethod(request.method()); feignRequest.setUrl(request.url()); if (logLevel.ordinal() >= Level.HEADERS.ordinal()) { for (String field : request.headers().keySet()) { for (String value : valuesOrEmpty(request.headers(), field)) { feignRequest.addHeader(field, value); } } if (request.body() != null && logLevel.ordinal() >= Level.FULL.ordinal()) { feignRequest.setBody(request.charset() != null ?
🌐
Medium
medium.com › @AlexanderObregon › navigating-client-server-communication-with-springs-feignclient-annotation-70376157cefd
Navigating Client-Server Communication with Spring’s @FeignClient Annotation
March 30, 2026 - In this configuration, the feignLoggerLevel bean tells Feign how much request and response detail to write, and the logging.level entry allows those logs to appear for YourServiceClient. Choose the Right Log Level: BASIC keeps the output focused on request method, URL, response status, and timing, while FULL also includes headers, body content, and more request and response detail.
Find elsewhere
🌐
Mingliang
mingliang.me › blog › rest-client-logging-in-spring-boot
Rest client logging in spring boot - You Will Never Walk Alone
July 23, 2019 - FULL, Log the headers, body, and metadata for both requests and responses. For example, the following would set the Logger.Level to FULL: @Configuration public class FooConfiguration { @Bean Logger.Level feignLoggerLevel() { return Logger.Level.FULL; } } Question: Need to understand if this configuration works with log4j2 configuration. https://blog.morizyun.com/java/spring-resttemplate-debug-logging.html ·
🌐
Getdocs
spring.getdocs.org › en-US › spring-cloud-docs › spring-cloud-openfeign › spring-cloud-feign › feign-logging.html
Untitled :: Spring Docs
The Logger.Level object that you may configure per client, tells Feign how much to log. Choices 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.
🌐
O'Reilly
oreilly.com › library › view › mastering-spring-boot › 9781787127562 › 43853f02-3bf6-4c2f-8661-e94899a05cdd.xhtml
Feign logging - Mastering Spring Boot 2.0 [Book]
May 31, 2018 - A logger is created for each Feign client. The log level can be changed by setting the logging.level.project.user.UserClient property in the configuration property. Let's see the following application.yml configuration file: ... BASIC: This level of log responds to the request method and URL and the response status code and execution time
Author: Dinesh Rajput
Published: 2018
Pages: 390
🌐
TheCodeForge
thecodeforge.io › home › java › spring cloud feign client: declarative http in microservices
Feign Client in Spring Boot Microservices: Spring Cloud | TheCodeForge
May 23, 2026 - Use @GetMapping, @PostMapping, @PutMapping, @DeleteMapping from Spring MVC. Path variables use @PathVariable, query parameters use @RequestParam, request bodies use @RequestBody, and headers use @RequestHeader.
🌐
CodingNConcepts
codingnconcepts.com › home › spring boot › configure feign client in spring boot
Configure Feign Client in Spring Boot - Coding N Concepts
June 8, 2021 - Once you enable the feign logging by setting the logging level to DEBUG, you can further control the logging using loggerLevel configuration property which tells Feign how much to log per request. Choices 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.
🌐
Junhyunny
junhyunny.github.io › spring-boot › spring-cloud › logging-for-feign-client
FeignClient 로깅 적용하기 - Junhyunny’s Devlogs
April 25, 2026 - HEADERS 설정에 추가적으로 요청, 응답에 대한 바디(body), 메타데이터(metadata) 정보를 볼 수 있다. package action.in.blog.config; import feign.Logger; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class FeignLoggerConfig { @Bean Logger.Level feignLoggerLevel() { return Logger.Level.FULL; } }
🌐
Spring Cloud
cloud.spring.io › spring-cloud-netflix › multi › multi_spring-cloud-feign.html
7. Declarative REST Client: Feign
The Logger.Level object that you may configure per client, tells Feign how much to log. Choices 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.
🌐
GitHub
github.com › PouyaPouryaie › feign-client
GitHub - PouyaPouryaie/feign-client: This repository demonstrates how to programmatically implement a Feign client in a Spring Boot application · GitHub
This repository demonstrates how to programmatically implement a Feign client in a Spring Boot application (client) to interact with an external service (server). This approach provides fine-grained control over the Feign client's configuration. This example showcases the following customizations for the Feign client in the client project: Customized Request Interceptor: Demonstrates how to add custom headers or modify requests before they are sent to the server external service. Customized Logger: Shows how to implement a custom logger that extends Feign's Logger for tailored logging behavior during communication with the server.
🌐
Stack Overflow
stackoverflow.com › questions › 57574238 › is-there-a-way-to-log-only-the-body-with-feign-spring-client
Is there a way to log only the body with feign spring client? - Stack Overflow
August 20, 2019 - API api = Feign.builder() .logger(new MyLogger()) .logLevel(Logger.Level.FULL) .target(API.class, "https://api.example.com"); All instances of this Feign Client will use your logger now.