1111import java .net .URL ;
1212import java .net .URLEncoder ;
1313import java .util .Set ;
14+
1415public class DefaultNSQLookup implements NSQLookup {
1516 Set <String > addresses = Sets .newHashSet ();
1617
@@ -32,20 +33,20 @@ public Set<ServerAddress> lookup(String topic) {
3233 ObjectMapper mapper = new ObjectMapper ();
3334 String topicEncoded = URLEncoder .encode (topic , Charsets .UTF_8 .name ());
3435 JsonNode jsonNode = mapper .readTree (new URL (addr + "/lookup?topic=" + topicEncoded ));
35- LogManager .getLogger (this ).debug ("Server connection information: " + jsonNode . toString () );
36+ LogManager .getLogger (this ).debug ("Server connection information: {}" , jsonNode );
3637 JsonNode producers = jsonNode .get ("data" ).get ("producers" );
3738 for (JsonNode node : producers ) {
3839 String host = node .get ("broadcast_address" ).asText ();
3940 ServerAddress address = new ServerAddress (host , node .get ("tcp_port" ).asInt ());
4041 addresses .add (address );
4142 }
4243 } catch (IOException e ) {
43- LogManager .getLogger (this ).warn ("Unable to connect to address {}" , addr );
44+ LogManager .getLogger (this ).warn ("Unable to connect to address {} for topic {} " , addr , topic );
4445 LogManager .getLogger (this ).debug (e .getMessage ());
4546 }
4647 }
4748 if (addresses .isEmpty ()) {
48- LogManager .getLogger (this ).warn ("Unable to connect to any NSQ Lookup servers, servers tried: " + this .addresses . toString () );
49+ LogManager .getLogger (this ).warn ("Unable to connect to any NSQ Lookup servers, servers tried: {} on topic: {}" , this .addresses , topic );
4950 }
5051 return addresses ;
5152 }
0 commit comments