Feign logging

As you know, logging is very important for every project. The Feign client only responds to a DEBUG level and, by default, the file name of the log is the full class name of the interface used to create the Feign client. 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:

logging: 
    level: 
      project: 
          user: 
            UserClient: debug 

You have the following choices of log level for your client application:

  • NONE: No logging (DEFAULT)
  • BASIC: This level of log responds to the request method and URL and the response status code and execution time
  • HEADERS: This level of log responds to the basic information along with the request and response headers
  • FULL: This level of log responds to the headers, body, and metadata for both requests and responses

Define the log level by using the Java configuration file for the Feign client, let's see the following example, set Logger.Level to FULL:

@Configuration 
public class AccountConfiguration { 
    @Bean 
    Logger.Level feignLoggerLevel() { 
        return Logger.Level.FULL; 
    } 
} 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.106.135