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 2013/11/08 06:20:11 UTC

svn commit: r1539924 - in /logging/log4net/trunk: src/log4net/ src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs tests/ tests/src/Hierarchy/XmlHierarchyConfiguratorTest.cs

Author: bodewig
Date: Fri Nov  8 05:20:10 2013
New Revision: 1539924

URL: http://svn.apache.org/r1539924
Log:
merge LOG4NET-132 fix from 1.2.x branch

Added:
    logging/log4net/trunk/tests/src/Hierarchy/XmlHierarchyConfiguratorTest.cs
      - copied unchanged from r1539693, logging/log4net/branches/log4net-1.2.x/tests/src/Hierarchy/XmlHierarchyConfiguratorTest.cs
Modified:
    logging/log4net/trunk/src/log4net/   (props changed)
    logging/log4net/trunk/src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs
    logging/log4net/trunk/tests/   (props changed)

Propchange: logging/log4net/trunk/src/log4net/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Nov  8 05:20:10 2013
@@ -0,0 +1,2 @@
+/logging/log4net/branches/1.2.12/src/log4net:1511686-1520870
+/logging/log4net/branches/log4net-1.2.x/src:1539687-1539693

Modified: logging/log4net/trunk/src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs?rev=1539924&r1=1539923&r2=1539924&view=diff
==============================================================================
--- logging/log4net/trunk/src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs (original)
+++ logging/log4net/trunk/src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs Fri Nov  8 05:20:10 2013
@@ -634,7 +634,11 @@ namespace log4net.Repository.Hierarchy
 					try
 					{
 						// Expand environment variables in the string.
-						propertyValue = OptionConverter.SubstituteVariables(propertyValue, Environment.GetEnvironmentVariables());
+					    IDictionary environmentVariables = Environment.GetEnvironmentVariables();
+					    if (HasCaseInsensitiveEnvironment) {
+						environmentVariables = CreateCaseInsensitiveWrapper(environmentVariables);
+					    }
+						propertyValue = OptionConverter.SubstituteVariables(propertyValue, environmentVariables);
 					}
 					catch(System.Security.SecurityException)
 					{
@@ -1023,6 +1027,30 @@ namespace log4net.Repository.Hierarchy
 
 		#endregion Protected Instance Methods
 
+#if !NETCF
+		private bool HasCaseInsensitiveEnvironment
+	        {
+		    get
+		    {
+			PlatformID platform = Environment.OSVersion.Platform;
+			return platform != PlatformID.Unix && platform != PlatformID.MacOSX;
+		    }
+		}
+
+	        private IDictionary CreateCaseInsensitiveWrapper(IDictionary dict)
+	        {
+		    if (dict == null)
+		    {
+			return dict;
+		    }
+		    Hashtable hash = SystemInfo.CreateCaseInsensitiveHashtable();
+		    foreach (DictionaryEntry entry in dict) {
+			hash[entry.Key] = entry.Value;
+		    }
+		    return hash;
+		}
+#endif
+
 		#region Private Constants
 
 		// String constants used while parsing the XML data

Propchange: logging/log4net/trunk/tests/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Nov  8 05:20:10 2013
@@ -0,0 +1,2 @@
+/logging/log4net/branches/1.2.12/tests:1511686-1520870
+/logging/log4net/branches/log4net-1.2.x/tests:1539687-1539693