mirror of
https://github.com/opensim/opensim.git
synced 2026-05-14 18:55:39 +08:00
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
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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" />
|
||||
|
||||
Reference in New Issue
Block a user