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
viewer-2-initial-appearance
BlueWall 2010-09-30 23:08:36 -04:00 committed by Melanie
parent eb58d91098
commit ffc1123ca5
2 changed files with 21 additions and 7 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;
if ( logConfig != null )
{
FileInfo cfg = new FileInfo(logConfig);
XmlConfigurator.Configure(cfg);
}
else
{
XmlConfigurator.Configure();
}
ILoggerRepository repository = LogManager.GetRepository();
IAppender[] appenders = repository.GetAppenders();
@ -207,13 +220,14 @@ namespace OpenSim.Server.Base
{
if (startupConfig != null)
{
fileName = startupConfig.GetString("logfile", fileName+".log");
fileName = Path.GetFullPath(Path.Combine(".", fileName));
fileAppender.File = fileName;
string cfgFileName = startupConfig.GetString("logfile", null);
if (cfgFileName != null)
{
fileAppender.File = cfgFileName;
fileAppender.ActivateOptions();
}
}
}
if (startupConfig.GetString("PIDFile", String.Empty) != String.Empty)
{

View File

@ -17,7 +17,7 @@
</appender>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file value="OpenSim.log" />
<file value="Robust.log" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level - %logger %message%newline" />