You can always do the dns lookup yourself and log an error if it's invalid. The DNS cache will ensure it's not wasted effort.
On Fri, Jan 25, 2013 at 2:39 PM, Robert Greenwalt <[email protected]>wrote: > I think the log was getting quite full of these exceptions (mobile devices > often don't have a network and apps aren't so good at checking that first) > so we stopped logging them. If you look at the blame for this code you can > see the reasoning. > > > > On Fri, Jan 25, 2013 at 2:31 PM, Boris Burtin <[email protected]> wrote: > >> I was racking my brain, trying to figure out why one of my users was >> having trouble connecting and nothing was in the logs. Finally I looked at >> the Android source and realized that the logging code explicitly ignores >> UnknownHostException. Even worse, the Javadoc doesn't specify this >> behavior. >> >> Does this sound like a bug to anyone, as opposed to a feature? In my >> case, the user enters the hostname, so it's possible to get this exception >> while the user has a network connection. >> >> /** >> * Handy function to get a loggable stack trace from a Throwable >> * @param tr An exception to log >> */ >> public static String getStackTraceString(Throwable tr) { >> if (tr == null) { >> return ""; >> } >> >> // This is to reduce the amount of log spew that apps do in the >> non-error >> // condition of the network being unavailable. >> Throwable t = tr; >> while (t != null) { >> if (t instanceof UnknownHostException) { >> return ""; >> } >> t = t.getCause(); >> } >> >> StringWriter sw = new StringWriter(); >> PrintWriter pw = new PrintWriter(sw); >> tr.printStackTrace(pw); >> return sw.toString(); >> } >> >> -- >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> >> >> > > -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

