logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpsen...@apache.org
Subject svn commit: r1489889 - /logging/log4net/trunk/src/Core/LoggingEvent.cs
Date Wed, 05 Jun 2013 14:42:14 GMT
Author: dpsenner
Date: Wed Jun  5 14:42:12 2013
New Revision: 1489889

URL: http://svn.apache.org/r1489889
Log:
LOG4NET-226 added catch ObjectDisposedException clause as suggested by Johannes Krackowizer
and confirmed by Ron Grabowski

Modified:
    logging/log4net/trunk/src/Core/LoggingEvent.cs

Modified: logging/log4net/trunk/src/Core/LoggingEvent.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Core/LoggingEvent.cs?rev=1489889&r1=1489888&r2=1489889&view=diff
==============================================================================
--- logging/log4net/trunk/src/Core/LoggingEvent.cs (original)
+++ logging/log4net/trunk/src/Core/LoggingEvent.cs Wed Jun  5 14:42:12 2013
@@ -893,7 +893,16 @@ namespace log4net.Core
 							m_data.Identity = "";
 						}
 					}
-					catch(System.Security.SecurityException)
+					catch (ObjectDisposedException)
+					{
+						// This exception will occur if System.Threading.Thread.CurrentPrincipal.Identity is
not null but
+						// the getter of the property Name tries to access disposed objects.
+						// Seen to happen on IIS 7 or greater with windows authentication.
+						LogLog.Debug(declaringType, "Object disposed exception while trying to get current
thread principal. Error Ignored. Empty identity name.");
+
+						m_data.Identity = "";
+					}
+					catch (System.Security.SecurityException)
 					{
 						// This security exception will occur if the caller does not have 
 						// some undefined set of SecurityPermission flags.
@@ -1530,4 +1539,4 @@ namespace log4net.Core
 
 		#endregion
 	}
-}
+}
\ No newline at end of file



Mime
View raw message