From fc1b1bc797c851cdc10f1db6708a7c22db546f46 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Fri, 3 Apr 2009 12:47:56 +0000 Subject: [PATCH] - adding -logconfig option to allow configuration of log4net from log4net config file other then bin/OpenSim.exe.config - moving ArgvConfigSource initialization up to allow for configuration of XmlConfigurator.Configure() --- OpenSim/Region/Application/Application.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 32033cc358..7244dc91f9 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -54,7 +54,20 @@ namespace OpenSim AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); - XmlConfigurator.Configure(); + ArgvConfigSource configSource = new ArgvConfigSource(args); + configSource.AddSwitch("Startup", "logconfig"); + string logConfigFile = configSource.Configs["Startup"].GetString("logconfig", String.Empty); + if (logConfigFile != String.Empty) + { + XmlConfigurator.Configure(new System.IO.FileInfo(logConfigFile)); + m_log.InfoFormat("[OPENSIM MAIN]: configured log4net using \"{0}\" as configuration file", + logConfigFile); + } + else + { + XmlConfigurator.Configure(); + m_log.Info("[OPENSIM MAIN]: configured log4net using default OpenSim.exe.config"); + } m_log.Info("Performing compatibility checks... "); string supported = String.Empty; @@ -69,7 +82,6 @@ namespace OpenSim Culture.SetCurrentCulture(); - ArgvConfigSource configSource = new ArgvConfigSource(args); configSource.Alias.AddAlias("On", true); configSource.Alias.AddAlias("Off", false);