Feign logging not working The 2019 Stack Overflow Developer Survey Results Are In Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceHow does the Java 'for each' loop work?How do servlets work? Instantiation, sessions, shared variables and multithreadingGetting the Current Working Directory in JavaSecuring Rest Web Service for Public Authentication - Server to ServerWhy not use java.util.logging?Basic authentication in REST-applicationServer logging with session metadata400 bad request after URL encodingLog file not being created after update log4j version to 1.1.5How do I encode Feign HTTP GET request params using Jackson?

Can we generate random numbers using irrational numbers like π and e?

What force causes entropy to increase?

Circular reasoning in L'Hopital's rule

Are there continuous functions who are the same in an interval but differ in at least one other point?

Presidential Pardon

How to type a long/em dash `—`

Are spiders unable to hurt humans, especially very small spiders?

Why are there uneven bright areas in this photo of black hole?

Didn't get enough time to take a Coding Test - what to do now?

Is this wall load bearing? Blueprints and photos attached

Is there a way to generate uniformly distributed points on a sphere from a fixed amount of random real numbers per point?

"... to apply for a visa" or "... and applied for a visa"?

Was credit for the black hole image misappropriated?

How did passengers keep warm on sail ships?

What was the last x86 CPU that did not have the x87 floating-point unit built in?

First use of “packing” as in carrying a gun

Did the new image of black hole confirm the general theory of relativity?

Drawing vertical/oblique lines in Metrical tree (tikz-qtree, tipa)

Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?

What is the role of 'For' here?

Simulating Exploding Dice

Button changing its text & action. Good or terrible?

Homework question about an engine pulling a train

Does Parliament hold absolute power in the UK?



Feign logging not working



The 2019 Stack Overflow Developer Survey Results Are In
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceHow does the Java 'for each' loop work?How do servlets work? Instantiation, sessions, shared variables and multithreadingGetting the Current Working Directory in JavaSecuring Rest Web Service for Public Authentication - Server to ServerWhy not use java.util.logging?Basic authentication in REST-applicationServer logging with session metadata400 bad request after URL encodingLog file not being created after update log4j version to 1.1.5How do I encode Feign HTTP GET request params using Jackson?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








8















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










share|improve this question






















  • Do you have any configuration file for the SLF4J that may be ignoring the logs for the MyClient class?

    – Sigrist
    Apr 20 '17 at 19:24











  • In my Spring Boot app Feign's logging is configured in application.yml as logging.level.com.mycompany.admintool.external.persons.resource.CustomerResource: DEBUG

    – Igor Bljahhin
    Jun 26 '17 at 8:48












  • I'm having the same problem here. did you find any solution?

    – Ali M
    Feb 2 '18 at 22:14

















8















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










share|improve this question






















  • Do you have any configuration file for the SLF4J that may be ignoring the logs for the MyClient class?

    – Sigrist
    Apr 20 '17 at 19:24











  • In my Spring Boot app Feign's logging is configured in application.yml as logging.level.com.mycompany.admintool.external.persons.resource.CustomerResource: DEBUG

    – Igor Bljahhin
    Jun 26 '17 at 8:48












  • I'm having the same problem here. did you find any solution?

    – Ali M
    Feb 2 '18 at 22:14













8












8








8


1






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










share|improve this question














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







java feign






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 12 '17 at 18:17









MagickMagick

81833056




81833056












  • Do you have any configuration file for the SLF4J that may be ignoring the logs for the MyClient class?

    – Sigrist
    Apr 20 '17 at 19:24











  • In my Spring Boot app Feign's logging is configured in application.yml as logging.level.com.mycompany.admintool.external.persons.resource.CustomerResource: DEBUG

    – Igor Bljahhin
    Jun 26 '17 at 8:48












  • I'm having the same problem here. did you find any solution?

    – Ali M
    Feb 2 '18 at 22:14

















  • Do you have any configuration file for the SLF4J that may be ignoring the logs for the MyClient class?

    – Sigrist
    Apr 20 '17 at 19:24











  • In my Spring Boot app Feign's logging is configured in application.yml as logging.level.com.mycompany.admintool.external.persons.resource.CustomerResource: DEBUG

    – Igor Bljahhin
    Jun 26 '17 at 8:48












  • I'm having the same problem here. did you find any solution?

    – Ali M
    Feb 2 '18 at 22:14
















Do you have any configuration file for the SLF4J that may be ignoring the logs for the MyClient class?

– Sigrist
Apr 20 '17 at 19:24





Do you have any configuration file for the SLF4J that may be ignoring the logs for the MyClient class?

– Sigrist
Apr 20 '17 at 19:24













In my Spring Boot app Feign's logging is configured in application.yml as logging.level.com.mycompany.admintool.external.persons.resource.CustomerResource: DEBUG

– Igor Bljahhin
Jun 26 '17 at 8:48






In my Spring Boot app Feign's logging is configured in application.yml as logging.level.com.mycompany.admintool.external.persons.resource.CustomerResource: DEBUG

– Igor Bljahhin
Jun 26 '17 at 8:48














I'm having the same problem here. did you find any solution?

– Ali M
Feb 2 '18 at 22:14





I'm having the same problem here. did you find any solution?

– Ali M
Feb 2 '18 at 22:14












4 Answers
4






active

oldest

votes


















5














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






share|improve this answer























  • It can also be set by @Bean , see github.com/spring-cloud/spring-cloud-netflix/issues/1769

    – whatacold
    Aug 12 '18 at 12:06


















1














You may also need to configure your log4j logging level for feign to DEBUG. If you are using spring boot, what worked for me is:



curl -X POST http://localhost/loggers/feign -H 'Content-Type: application/json' -d '"configuredLevel": "DEBUG"'





share|improve this answer






























    0














    private void setup() 
    //...
    feignBuilder.logger(new MyLogger());
    feignBuilder.logLevel(Logger.Level.FULL);


    private static class MyLogger extends Logger
    @Override
    protected void log(String s, String s1, Object... objects)
    System.out.println(String.format(s + s1, objects)); // Change me!







    share|improve this answer






























      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





      share|improve this answer























        Your Answer






        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "1"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42751269%2ffeign-logging-not-working%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        5














        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






        share|improve this answer























        • It can also be set by @Bean , see github.com/spring-cloud/spring-cloud-netflix/issues/1769

          – whatacold
          Aug 12 '18 at 12:06















        5














        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






        share|improve this answer























        • It can also be set by @Bean , see github.com/spring-cloud/spring-cloud-netflix/issues/1769

          – whatacold
          Aug 12 '18 at 12:06













        5












        5








        5







        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






        share|improve this answer













        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







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jun 14 '18 at 13:42









        MaverickMaverick

        549723




        549723












        • It can also be set by @Bean , see github.com/spring-cloud/spring-cloud-netflix/issues/1769

          – whatacold
          Aug 12 '18 at 12:06

















        • It can also be set by @Bean , see github.com/spring-cloud/spring-cloud-netflix/issues/1769

          – whatacold
          Aug 12 '18 at 12:06
















        It can also be set by @Bean , see github.com/spring-cloud/spring-cloud-netflix/issues/1769

        – whatacold
        Aug 12 '18 at 12:06





        It can also be set by @Bean , see github.com/spring-cloud/spring-cloud-netflix/issues/1769

        – whatacold
        Aug 12 '18 at 12:06













        1














        You may also need to configure your log4j logging level for feign to DEBUG. If you are using spring boot, what worked for me is:



        curl -X POST http://localhost/loggers/feign -H 'Content-Type: application/json' -d '"configuredLevel": "DEBUG"'





        share|improve this answer



























          1














          You may also need to configure your log4j logging level for feign to DEBUG. If you are using spring boot, what worked for me is:



          curl -X POST http://localhost/loggers/feign -H 'Content-Type: application/json' -d '"configuredLevel": "DEBUG"'





          share|improve this answer

























            1












            1








            1







            You may also need to configure your log4j logging level for feign to DEBUG. If you are using spring boot, what worked for me is:



            curl -X POST http://localhost/loggers/feign -H 'Content-Type: application/json' -d '"configuredLevel": "DEBUG"'





            share|improve this answer













            You may also need to configure your log4j logging level for feign to DEBUG. If you are using spring boot, what worked for me is:



            curl -X POST http://localhost/loggers/feign -H 'Content-Type: application/json' -d '"configuredLevel": "DEBUG"'






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Apr 30 '18 at 21:12









            StimpStimp

            18918




            18918





















                0














                private void setup() 
                //...
                feignBuilder.logger(new MyLogger());
                feignBuilder.logLevel(Logger.Level.FULL);


                private static class MyLogger extends Logger
                @Override
                protected void log(String s, String s1, Object... objects)
                System.out.println(String.format(s + s1, objects)); // Change me!







                share|improve this answer



























                  0














                  private void setup() 
                  //...
                  feignBuilder.logger(new MyLogger());
                  feignBuilder.logLevel(Logger.Level.FULL);


                  private static class MyLogger extends Logger
                  @Override
                  protected void log(String s, String s1, Object... objects)
                  System.out.println(String.format(s + s1, objects)); // Change me!







                  share|improve this answer

























                    0












                    0








                    0







                    private void setup() 
                    //...
                    feignBuilder.logger(new MyLogger());
                    feignBuilder.logLevel(Logger.Level.FULL);


                    private static class MyLogger extends Logger
                    @Override
                    protected void log(String s, String s1, Object... objects)
                    System.out.println(String.format(s + s1, objects)); // Change me!







                    share|improve this answer













                    private void setup() 
                    //...
                    feignBuilder.logger(new MyLogger());
                    feignBuilder.logLevel(Logger.Level.FULL);


                    private static class MyLogger extends Logger
                    @Override
                    protected void log(String s, String s1, Object... objects)
                    System.out.println(String.format(s + s1, objects)); // Change me!








                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 8 at 12:51









                    Jean-Alexis AufauvreJean-Alexis Aufauvre

                    765




                    765





















                        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





                        share|improve this answer



























                          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





                          share|improve this answer

























                            0












                            0








                            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





                            share|improve this answer













                            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






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Mar 22 at 5:42









                            Niraj SonawaneNiraj Sonawane

                            2,52022044




                            2,52022044



























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42751269%2ffeign-logging-not-working%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                                Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                                Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript