From 8321948b3c970c14c1d4e2c1ddfa829d135e9b75 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 27 Mar 2014 11:02:52 +0100 Subject: [PATCH] Add log to DNSUtil --- .../main/java/org/jivesoftware/smack/util/DNSUtil.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java b/core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java index 83e0499f4..0027e7a85 100644 --- a/core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java +++ b/core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java @@ -22,6 +22,8 @@ import java.util.LinkedList; import java.util.List; import java.util.SortedMap; import java.util.TreeMap; +import java.util.logging.Level; +import java.util.logging.Logger; import org.jivesoftware.smack.util.dns.DNSResolver; import org.jivesoftware.smack.util.dns.HostAddress; @@ -34,6 +36,7 @@ import org.jivesoftware.smack.util.dns.SRVRecord; */ public class DNSUtil { + private static final Logger LOGGER = Logger.getLogger(DNSUtil.class.getName()); private static DNSResolver dnsResolver = null; /** @@ -121,6 +124,12 @@ public class DNSUtil { srvDomain = domain; } List srvRecords = dnsResolver.lookupSRVRecords(srvDomain); + if (LOGGER.isLoggable(Level.FINE)) { + String logMessage = "Resolved SRV RR for " + srvDomain + ":"; + for (SRVRecord r : srvRecords) + logMessage += " " + r; + LOGGER.fine(logMessage); + } List sortedRecords = sortSRVRecords(srvRecords); addresses.addAll(sortedRecords);