From ffc1123ca5225e9aa74b9863fedc3291a58d3923 Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Thu, 30 Sep 2010 23:08:36 -0400
Subject: adding -logconfig to Robust.exe

	Adding -logconfig to Robust.exe. will still process the
	-logfile option, as before. No options given, the value
	"Robust.log" will be written in the ./bin directory
---
 OpenSim/Server/Base/ServicesServerBase.cs | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

(limited to 'OpenSim/Server')

diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs
index dee31bd..18f0f24 100644
--- a/OpenSim/Server/Base/ServicesServerBase.cs
+++ b/OpenSim/Server/Base/ServicesServerBase.cs
@@ -85,11 +85,13 @@ namespace OpenSim.Server.Base
             argvConfig.AddSwitch("Startup", "logfile", "l");
             argvConfig.AddSwitch("Startup", "inifile", "i");
             argvConfig.AddSwitch("Startup", "prompt",  "p");
+            argvConfig.AddSwitch("Startup", "logconfig", "g");
 
             // Automagically create the ini file name
             //
             string fileName = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location);
             string iniFile = fileName + ".ini";
+            string logConfig = null;
 
             IConfig startupConfig = argvConfig.Configs["Startup"];
             if (startupConfig != null)
@@ -100,6 +102,9 @@ namespace OpenSim.Server.Base
                 //
                 // Check if a prompt was given on the command line
                 prompt = startupConfig.GetString("prompt", prompt);
+                //
+                // Check for a Log4Net config file on the command line
+                logConfig =startupConfig.GetString("logconfig",logConfig);
             }
 
             // Find out of the file name is a URI and remote load it
@@ -171,7 +176,15 @@ namespace OpenSim.Server.Base
             OpenSimAppender consoleAppender = null;
             FileAppender fileAppender = null;
 
-            XmlConfigurator.Configure();
+            if ( logConfig != null )
+            {
+                FileInfo cfg = new FileInfo(logConfig);
+                XmlConfigurator.Configure(cfg);
+            }
+            else
+            {
+                XmlConfigurator.Configure();
+            }
 
             ILoggerRepository repository = LogManager.GetRepository();
             IAppender[] appenders = repository.GetAppenders();
@@ -207,11 +220,12 @@ namespace OpenSim.Server.Base
             {
                 if (startupConfig != null)
                 {
-
-                    fileName = startupConfig.GetString("logfile", fileName+".log");
-                    fileName = Path.GetFullPath(Path.Combine(".", fileName));
-                    fileAppender.File = fileName;
-                    fileAppender.ActivateOptions();
+                    string cfgFileName = startupConfig.GetString("logfile", null);
+                    if (cfgFileName != null)
+                    {
+                        fileAppender.File = cfgFileName;
+                        fileAppender.ActivateOptions();
+                    }
                 }
             }
 
-- 
cgit v1.1