Return-Path: X-Original-To: apmail-logging-commits-archive@minotaur.apache.org Delivered-To: apmail-logging-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B197E10461 for ; Thu, 6 Jun 2013 08:34:21 +0000 (UTC) Received: (qmail 64225 invoked by uid 500); 6 Jun 2013 08:34:21 -0000 Delivered-To: apmail-logging-commits-archive@logging.apache.org Received: (qmail 64178 invoked by uid 500); 6 Jun 2013 08:34:18 -0000 Mailing-List: contact commits-help@logging.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@logging.apache.org Delivered-To: mailing list commits@logging.apache.org Received: (qmail 64164 invoked by uid 99); 6 Jun 2013 08:34:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jun 2013 08:34:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jun 2013 08:34:15 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 7A7542388900; Thu, 6 Jun 2013 08:33:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1490196 - /logging/log4net/trunk/src/Util/SystemInfo.cs Date: Thu, 06 Jun 2013 08:33:55 -0000 To: commits@logging.apache.org From: dpsenner@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130606083355.7A7542388900@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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;