2

I'm creating a microservices system and I have Zuul server where I use Ribbon which connects to Eureka(which returns me the available service instances) and perform load-balancing. Everything works great, however I would like to see in the logs which particular instance was chosen by Ribbon. I know that I can add some extra logging to the instances but I want to have it in one place. I've read Ribbon documentation and I haven't found any information how to do it... I would be very grateful for your help.

user2455862
  • 585
  • 10
  • 26
  • Anyone any ideas? – user2455862 Jan 31 '18 at 20:09
  • On the Ribbon github page, at the end of the Readme, you find this: `Questions? Email ribbon-users@googlegroups.com or join us`. Have you tried this? – Constantin Galbenu Feb 01 '18 at 07:03
  • Looks like there might be some logging in LoadBalancerContext. If you enable logging for your platform for the package containing that class you might see what you are looking for depending on how you are using Ribbon. – Ryan Baxter Feb 01 '18 at 14:38
  • Have you looked at this? https://stackoverflow.com/questions/46143509/how-to-capture-log-on-each-instance-of-the-microservice-through-zuul – pan Feb 02 '18 at 16:07

1 Answers1

1

Try to add DEBUG logger level:

  1. com.netflix.loadbalancer.LoadBalancerContext

It's printing messages like:

my-service using LB returned Server: host:port for request http:request-url
  1. com.netflix.loadbalancer.reactive.LoadBalancerCommand printing:
Got error java.net.ConnectException: Connection refused (Connection refused) when executed on server host:port
  1. all 'com.netflix' also can help

For example my logback.groovy has a line:

logger('com.netflix', DEBUG)