diff options
author | BlueWall | 2010-09-30 23:08:36 -0400 |
---|---|---|
committer | Melanie | 2010-10-01 05:42:18 +0100 |
commit | ffc1123ca5225e9aa74b9863fedc3291a58d3923 (patch) | |
tree | f22a80a916d1171fdabc7fabe78b4416110bd203 | |
parent | Prevent dropping someone else's attachments (diff) | |
download | opensim-SC-ffc1123ca5225e9aa74b9863fedc3291a58d3923.zip opensim-SC-ffc1123ca5225e9aa74b9863fedc3291a58d3923.tar.gz opensim-SC-ffc1123ca5225e9aa74b9863fedc3291a58d3923.tar.bz2 opensim-SC-ffc1123ca5225e9aa74b9863fedc3291a58d3923.tar.xz |
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
-rw-r--r-- | OpenSim/Server/Base/ServicesServerBase.cs | 26 | ||||
-rw-r--r-- | bin/Robust.exe.config | 2 |
2 files changed, 21 insertions, 7 deletions
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index dee31bd..18f0f24 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs | |||
@@ -85,11 +85,13 @@ namespace OpenSim.Server.Base | |||
85 | argvConfig.AddSwitch("Startup", "logfile", "l"); | 85 | argvConfig.AddSwitch("Startup", "logfile", "l"); |
86 | argvConfig.AddSwitch("Startup", "inifile", "i"); | 86 | argvConfig.AddSwitch("Startup", "inifile", "i"); |
87 | argvConfig.AddSwitch("Startup", "prompt", "p"); | 87 | argvConfig.AddSwitch("Startup", "prompt", "p"); |
88 | argvConfig.AddSwitch("Startup", "logconfig", "g"); | ||
88 | 89 | ||
89 | // Automagically create the ini file name | 90 | // Automagically create the ini file name |
90 | // | 91 | // |
91 | string fileName = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location); | 92 | string fileName = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location); |
92 | string iniFile = fileName + ".ini"; | 93 | string iniFile = fileName + ".ini"; |
94 | string logConfig = null; | ||
93 | 95 | ||
94 | IConfig startupConfig = argvConfig.Configs["Startup"]; | 96 | IConfig startupConfig = argvConfig.Configs["Startup"]; |
95 | if (startupConfig != null) | 97 | if (startupConfig != null) |
@@ -100,6 +102,9 @@ namespace OpenSim.Server.Base | |||
100 | // | 102 | // |
101 | // Check if a prompt was given on the command line | 103 | // Check if a prompt was given on the command line |
102 | prompt = startupConfig.GetString("prompt", prompt); | 104 | prompt = startupConfig.GetString("prompt", prompt); |
105 | // | ||
106 | // Check for a Log4Net config file on the command line | ||
107 | logConfig =startupConfig.GetString("logconfig",logConfig); | ||
103 | } | 108 | } |
104 | 109 | ||
105 | // Find out of the file name is a URI and remote load it | 110 | // Find out of the file name is a URI and remote load it |
@@ -171,7 +176,15 @@ namespace OpenSim.Server.Base | |||
171 | OpenSimAppender consoleAppender = null; | 176 | OpenSimAppender consoleAppender = null; |
172 | FileAppender fileAppender = null; | 177 | FileAppender fileAppender = null; |
173 | 178 | ||
174 | XmlConfigurator.Configure(); | 179 | if ( logConfig != null ) |
180 | { | ||
181 | FileInfo cfg = new FileInfo(logConfig); | ||
182 | XmlConfigurator.Configure(cfg); | ||
183 | } | ||
184 | else | ||
185 | { | ||
186 | XmlConfigurator.Configure(); | ||
187 | } | ||
175 | 188 | ||
176 | ILoggerRepository repository = LogManager.GetRepository(); | 189 | ILoggerRepository repository = LogManager.GetRepository(); |
177 | IAppender[] appenders = repository.GetAppenders(); | 190 | IAppender[] appenders = repository.GetAppenders(); |
@@ -207,11 +220,12 @@ namespace OpenSim.Server.Base | |||
207 | { | 220 | { |
208 | if (startupConfig != null) | 221 | if (startupConfig != null) |
209 | { | 222 | { |
210 | 223 | string cfgFileName = startupConfig.GetString("logfile", null); | |
211 | fileName = startupConfig.GetString("logfile", fileName+".log"); | 224 | if (cfgFileName != null) |
212 | fileName = Path.GetFullPath(Path.Combine(".", fileName)); | 225 | { |
213 | fileAppender.File = fileName; | 226 | fileAppender.File = cfgFileName; |
214 | fileAppender.ActivateOptions(); | 227 | fileAppender.ActivateOptions(); |
228 | } | ||
215 | } | 229 | } |
216 | } | 230 | } |
217 | 231 | ||
diff --git a/bin/Robust.exe.config b/bin/Robust.exe.config index c2d93c0..4914f55 100644 --- a/bin/Robust.exe.config +++ b/bin/Robust.exe.config | |||
@@ -17,7 +17,7 @@ | |||
17 | </appender> | 17 | </appender> |
18 | 18 | ||
19 | <appender name="LogFileAppender" type="log4net.Appender.FileAppender"> | 19 | <appender name="LogFileAppender" type="log4net.Appender.FileAppender"> |
20 | <file value="OpenSim.log" /> | 20 | <file value="Robust.log" /> |
21 | <appendToFile value="true" /> | 21 | <appendToFile value="true" /> |
22 | <layout type="log4net.Layout.PatternLayout"> | 22 | <layout type="log4net.Layout.PatternLayout"> |
23 | <conversionPattern value="%date %-5level - %logger %message%newline" /> | 23 | <conversionPattern value="%date %-5level - %logger %message%newline" /> |