Merge branch 'master' into careminster-presence-refactor

This commit is contained in:
Melanie
2010-10-02 19:51:43 +01:00
5 changed files with 56 additions and 26 deletions

View File

@@ -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();
}
}
}