You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by dp...@apache.org on 2013/06/06 10:33:55 UTC
svn commit: r1490196 - /logging/log4net/trunk/src/Util/SystemInfo.cs
Author: dpsenner
Date: Thu Jun 6 08:33:55 2013
New Revision: 1490196
URL: http://svn.apache.org/r1490196
Log:
LOG4NET-228 improved exception handling for getting the computers hostname
Modified:
logging/log4net/trunk/src/Util/SystemInfo.cs
Modified: logging/log4net/trunk/src/Util/SystemInfo.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/SystemInfo.cs?rev=1490196&r1=1490195&r2=1490196&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/SystemInfo.cs (original)
+++ logging/log4net/trunk/src/Util/SystemInfo.cs Thu Jun 6 08:33:55 2013
@@ -263,13 +263,19 @@ namespace log4net.Util
// Lookup the host name
s_hostName = System.Net.Dns.GetHostName();
}
- catch(System.Net.Sockets.SocketException)
+ catch (System.Net.Sockets.SocketException)
{
+ LogLog.Debug(declaringType, "Socket exception occurred while getting the dns hostname. Error Ignored.");
}
- catch(System.Security.SecurityException)
+ catch (System.Security.SecurityException)
{
// We may get a security exception looking up the hostname
// You must have Unrestricted DnsPermission to access resource
+ LogLog.Debug(declaringType, "Security exception occurred while getting the dns hostname. Error Ignored.");
+ }
+ catch (Exception ex)
+ {
+ LogLog.Debug(declaringType, "Some other exception occurred while getting the dns hostname. Error Ignored.", ex);
}
// Get the NETBIOS machine name of the current machine
@@ -295,6 +301,7 @@ namespace log4net.Util
if (s_hostName == null || s_hostName.Length == 0)
{
s_hostName = s_notAvailableText;
+ LogLog.Debug(declaringType, "Could not determine the hostname. Error Ignored. Empty host name will be used");
}
}
return s_hostName;