* Added 'LogFilename' attribute to simconfig.xml - in order to specify log name
* removed some greedy try-catch * ignored some binsSugilite
parent
3c8daee510
commit
c6b99fbca5
|
@ -49,8 +49,7 @@ namespace OpenSim.GenericConfig
|
|||
public void LoadData()
|
||||
{
|
||||
doc = new XmlDocument();
|
||||
try
|
||||
{
|
||||
|
||||
if (System.IO.File.Exists(fileName))
|
||||
{
|
||||
XmlTextReader reader = new XmlTextReader(fileName);
|
||||
|
@ -67,14 +66,7 @@ namespace OpenSim.GenericConfig
|
|||
rootNode.AppendChild(configNode);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
rootNode = doc.FirstChild;
|
||||
if (rootNode.Name != "Root")
|
||||
throw new Exception("Error: Invalid .xml File. Missing <Root>");
|
||||
|
@ -83,11 +75,6 @@ namespace OpenSim.GenericConfig
|
|||
if (configNode.Name != "Config")
|
||||
throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>");
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
if (createdFile)
|
||||
{
|
||||
this.Commit();
|
||||
|
|
|
@ -63,6 +63,8 @@ namespace OpenSim
|
|||
private CheckSumServer checkServer;
|
||||
protected CommunicationsManager commsManager;
|
||||
|
||||
private bool m_silent;
|
||||
private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log";
|
||||
|
||||
public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile)
|
||||
{
|
||||
|
@ -71,8 +73,7 @@ namespace OpenSim
|
|||
m_loginserver = startLoginServer;
|
||||
m_physicsEngine = physicsEngine;
|
||||
m_config = configFile;
|
||||
m_console = new ConsoleBase("region-console-" + Guid.NewGuid().ToString() + ".log", "Region", this, silent);
|
||||
OpenSim.Framework.Console.MainConsole.Instance = m_console;
|
||||
m_silent = silent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -81,19 +82,18 @@ namespace OpenSim
|
|||
public override void StartUp()
|
||||
{
|
||||
this.serversData = new NetworkServersInfo();
|
||||
try
|
||||
{
|
||||
|
||||
this.localConfig = new XmlConfig(m_config);
|
||||
this.localConfig.LoadData();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
|
||||
if (this.configFileSetup)
|
||||
{
|
||||
this.SetupFromConfigFile(this.localConfig);
|
||||
}
|
||||
|
||||
m_console = new ConsoleBase(m_logFilename, "Region", this, m_silent);
|
||||
OpenSim.Framework.Console.MainConsole.Instance = m_console;
|
||||
|
||||
m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Loading configuration");
|
||||
this.serversData.InitConfig(this.m_sandbox, this.localConfig);
|
||||
this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change
|
||||
|
@ -284,10 +284,19 @@ namespace OpenSim
|
|||
|
||||
private void SetupFromConfigFile(IGenericConfig configData)
|
||||
{
|
||||
try
|
||||
{
|
||||
// SandBoxMode
|
||||
// Log filename
|
||||
string attri = "";
|
||||
attri = configData.GetAttribute("LogFilename");
|
||||
if (String.IsNullOrEmpty(attri))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
m_logFilename = attri;
|
||||
}
|
||||
|
||||
// SandBoxMode
|
||||
attri = "";
|
||||
attri = configData.GetAttribute("SandBox");
|
||||
if ((attri == "") || ((attri != "false") && (attri != "true")))
|
||||
{
|
||||
|
@ -372,14 +381,7 @@ namespace OpenSim
|
|||
}
|
||||
|
||||
configData.Commit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
Console.WriteLine("\nSorry, a fatal error occurred while trying to initialise the configuration data");
|
||||
Console.WriteLine("Can not continue starting up");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue