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;
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
add a comment |
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
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 aslogging.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
add a comment |
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
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
java feign
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 aslogging.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
add a comment |
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 aslogging.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
add a comment |
4 Answers
4
active
oldest
votes
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
It can also be set by@Bean
, see github.com/spring-cloud/spring-cloud-netflix/issues/1769
– whatacold
Aug 12 '18 at 12:06
add a comment |
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"'
add a comment |
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!
add a comment |
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
It can also be set by@Bean
, see github.com/spring-cloud/spring-cloud-netflix/issues/1769
– whatacold
Aug 12 '18 at 12:06
add a comment |
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
It can also be set by@Bean
, see github.com/spring-cloud/spring-cloud-netflix/issues/1769
– whatacold
Aug 12 '18 at 12:06
add a comment |
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
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
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
add a comment |
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
add a comment |
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"'
add a comment |
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"'
add a comment |
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"'
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"'
answered Apr 30 '18 at 21:12
StimpStimp
18918
18918
add a comment |
add a comment |
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!
add a comment |
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!
add a comment |
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!
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!
answered Mar 8 at 12:51
Jean-Alexis AufauvreJean-Alexis Aufauvre
765
765
add a comment |
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Mar 22 at 5:42
Niraj SonawaneNiraj Sonawane
2,52022044
2,52022044
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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