logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1167161 - /logging/log4net/trunk/src/Core/DefaultRepositorySelector.cs
Date Fri, 09 Sep 2011 13:39:13 GMT
Author: bodewig
Date: Fri Sep  9 13:39:13 2011
New Revision: 1167161

URL: http://svn.apache.org/viewvc?rev=1167161&view=rev
Log:
properly resolve relative URI of config file name given via log4net.Config appsetting.  LOG4NET-143

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

Modified: logging/log4net/trunk/src/Core/DefaultRepositorySelector.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Core/DefaultRepositorySelector.cs?rev=1167161&r1=1167160&r2=1167161&view=diff
==============================================================================
--- logging/log4net/trunk/src/Core/DefaultRepositorySelector.cs (original)
+++ logging/log4net/trunk/src/Core/DefaultRepositorySelector.cs Fri Sep  9 13:39:13 2011
@@ -697,6 +697,12 @@ namespace log4net.Core
 						LogLog.Warn(declaringType, "Exception getting ApplicationBaseDirectory. appSettings
log4net.Config path ["+repositoryConfigFile+"] will be treated as an absolute URI", ex);
 					}
 
+                    string repositoryConfigFilePath = repositoryConfigFile;
+                    if (applicationBaseDirectory != null)
+                    {
+                        repositoryConfigFilePath = Path.Combine(applicationBaseDirectory,
repositoryConfigFile);
+                    }
+
                     // Determine whether to watch the file or not based on an app setting
value:
 				    bool watchRepositoryConfigFile = false;
 				    Boolean.TryParse(SystemInfo.GetAppSetting("log4net.Config.Watch"), out watchRepositoryConfigFile);
@@ -705,11 +711,6 @@ namespace log4net.Core
 					{
  						// As we are going to watch the config file it is required to resolve it as a 
  						// physical file system path pass that in a FileInfo object to the Configurator
-                        string repositoryConfigFilePath = repositoryConfigFile;
-                        if (applicationBaseDirectory != null)
-                        {
-                            repositoryConfigFilePath = Path.Combine(applicationBaseDirectory,
repositoryConfigFile);
-                        }
 						FileInfo repositoryConfigFileInfo = null;
 						try
 						{
@@ -737,15 +738,7 @@ namespace log4net.Core
 					Uri repositoryConfigUri = null;
 					try
 					{
-						if (applicationBaseDirectory != null)
-						{
-							// Resolve the config path relative to the application base directory URI
-							repositoryConfigUri = new Uri(new Uri(applicationBaseDirectory), repositoryConfigFile);
-						}
-						else
-						{
-							repositoryConfigUri = new Uri(repositoryConfigFile);
-						}
+					    repositoryConfigUri = new Uri(repositoryConfigFilePath);
 					}
 					catch(Exception ex)
 					{



Mime
View raw message