You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by bo...@apache.org on 2015/08/23 18:12:13 UTC

svn commit: r1697210 - in /logging/log4net/branches/log4net-1.2.x: src/ src/Util/SystemInfo.cs tests/src/ tests/src/Appender/RollingFileAppenderTest.cs tests/src/Util/SystemInfoTest.cs

Author: bodewig
Date: Sun Aug 23 16:12:13 2015
New Revision: 1697210

URL: http://svn.apache.org/r1697210
Log:
merge changes for types loaded from GAC

Modified:
    logging/log4net/branches/log4net-1.2.x/src/   (props changed)
    logging/log4net/branches/log4net-1.2.x/src/Util/SystemInfo.cs
    logging/log4net/branches/log4net-1.2.x/tests/src/   (props changed)
    logging/log4net/branches/log4net-1.2.x/tests/src/Appender/RollingFileAppenderTest.cs
    logging/log4net/branches/log4net-1.2.x/tests/src/Util/SystemInfoTest.cs

Propchange: logging/log4net/branches/log4net-1.2.x/src/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Aug 23 16:12:13 2015
@@ -1,4 +1,4 @@
 /logging/log4net/branches/1.2.12/src:1511686-1520870
 /logging/log4net/tags/1.2.13RC1/src:1539445-1539920
 /logging/log4net/trunk/src:1539083
-/logging/log4net/trunk/src/log4net:1541408,1544744,1665915,1669884-1669885,1669887-1669888,1669935
+/logging/log4net/trunk/src/log4net:1541408,1544744,1665915,1669884-1669885,1669887-1669888,1669935,1669954,1669998

Modified: logging/log4net/branches/log4net-1.2.x/src/Util/SystemInfo.cs
URL: http://svn.apache.org/viewvc/logging/log4net/branches/log4net-1.2.x/src/Util/SystemInfo.cs?rev=1697210&r1=1697209&r2=1697210&view=diff
==============================================================================
--- logging/log4net/branches/log4net-1.2.x/src/Util/SystemInfo.cs (original)
+++ logging/log4net/branches/log4net-1.2.x/src/Util/SystemInfo.cs Sun Aug 23 16:12:13 2015
@@ -692,17 +692,29 @@ namespace log4net.Util
 
 				if (loadedAssemblies != null)
 				{
+					Type fallback = null;
 					// Search the loaded assemblies for the type
 					foreach (Assembly assembly in loadedAssemblies) 
 					{
-						type = assembly.GetType(typeName, false, ignoreCase);
-						if (type != null)
+						Type t = assembly.GetType(typeName, false, ignoreCase);
+						if (t != null)
 						{
 							// Found type in loaded assembly
 							LogLog.Debug(declaringType, "Loaded type ["+typeName+"] from assembly ["+assembly.FullName+"] by searching loaded assemblies.");
-							return type;
+                                                        if (assembly.GlobalAssemblyCache)
+                                                        {
+                                                            fallback = t;
+                                                        }
+                                                        else
+                                                        {
+                                                            return t;
+                                                        }
 						}
 					}
+                                        if (fallback != null)
+                                        {
+                                            return fallback;
+                                        }
 				}
 
 				// Didn't find the type

Propchange: logging/log4net/branches/log4net-1.2.x/tests/src/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Aug 23 16:12:13 2015
@@ -1,4 +1,4 @@
 /logging/log4net/branches/1.2.12/tests/src:1511686-1520870
 /logging/log4net/tags/1.2.13RC1/tests/src:1539445-1539920
-/logging/log4net/trunk/src/log4net.Tests:1669884,1669888
+/logging/log4net/trunk/src/log4net.Tests:1669884,1669888,1669954
 /logging/log4net/trunk/tests/src:1539083

Modified: logging/log4net/branches/log4net-1.2.x/tests/src/Appender/RollingFileAppenderTest.cs
URL: http://svn.apache.org/viewvc/logging/log4net/branches/log4net-1.2.x/tests/src/Appender/RollingFileAppenderTest.cs?rev=1697210&r1=1697209&r2=1697210&view=diff
==============================================================================
--- logging/log4net/branches/log4net-1.2.x/tests/src/Appender/RollingFileAppenderTest.cs (original)
+++ logging/log4net/branches/log4net-1.2.x/tests/src/Appender/RollingFileAppenderTest.cs Sun Aug 23 16:12:13 2015
@@ -1434,7 +1434,7 @@ namespace log4net.Tests.Appender
 			Repository.Hierarchy.Hierarchy h = (Repository.Hierarchy.Hierarchy)LogManager.GetRepository("TestRepository");
 			h.ResetConfiguration();
 			//Replace the repository selector so that we can recreate the hierarchy with the same name if necessary
-			LoggerManager.RepositorySelector = new DefaultRepositorySelector(SystemInfo.GetTypeFromString("log4net.Repository.Hierarchy.Hierarchy", true, true));
+			LoggerManager.RepositorySelector = new DefaultRepositorySelector(typeof(log4net.Repository.Hierarchy.Hierarchy));
 		}
 
 		private static void AssertFileEquals(string filename, string contents)
@@ -1542,7 +1542,7 @@ namespace log4net.Tests.Appender
 			DestroyLogger();
 
 			Assert.IsTrue(locked, "File was not locked");
-#if !MONO // at least on Linux with Mono 2.4 exclusive locking doesn't work as one would expect
+#if !MONO || MONO_3_5 || MONO_4_0 // at least on Linux with Mono 2.4 exclusive locking doesn't work as one would expect
 			AssertFileEquals(filename, "This is a message" + Environment.NewLine + "This is a message 2" + Environment.NewLine);
 #endif
 			Assert.AreEqual("", sh.Message, "Unexpected error message");
@@ -1702,7 +1702,7 @@ namespace log4net.Tests.Appender
 			Assert.AreEqual(1, appenders.Length, "The wrong number of appenders are configured");
 
 			RollingFileAppender rfa = (RollingFileAppender)(appenders[0]);
-			Assert.AreEqual(SystemInfo.GetTypeFromString("log4net.Appender.FileAppender+ExclusiveLock", true, true), rfa.LockingModel.GetType(), "The LockingModel is of an unexpected type");
+			Assert.AreEqual(typeof(log4net.Appender.FileAppender.ExclusiveLock), rfa.LockingModel.GetType(), "The LockingModel is of an unexpected type");
 
 			DestroyLogger();
 		}

Modified: logging/log4net/branches/log4net-1.2.x/tests/src/Util/SystemInfoTest.cs
URL: http://svn.apache.org/viewvc/logging/log4net/branches/log4net-1.2.x/tests/src/Util/SystemInfoTest.cs?rev=1697210&r1=1697209&r2=1697210&view=diff
==============================================================================
--- logging/log4net/branches/log4net-1.2.x/tests/src/Util/SystemInfoTest.cs (original)
+++ logging/log4net/branches/log4net-1.2.x/tests/src/Util/SystemInfoTest.cs Sun Aug 23 16:12:13 2015
@@ -117,7 +117,9 @@ namespace log4net.Tests.Util
 			Type t;
 
 			t = SystemInfo.GetTypeFromString("log4net.Util.SystemInfo", false, false);
-			Assert.AreSame(typeof(SystemInfo), t, "Test explicit case sensitive type load");
+			Assert.AreSame(typeof(SystemInfo), t,
+                                       string.Format("Test explicit case sensitive type load found {0} rather than {1}",
+                                                     t.AssemblyQualifiedName, typeof(SystemInfo).AssemblyQualifiedName));
 
 			t = SystemInfo.GetTypeFromString("LOG4NET.UTIL.SYSTEMINFO", false, true);
 			Assert.AreSame(typeof(SystemInfo), t, "Test explicit case in-sensitive type load caps");