aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/ConfigurationMember.cs
diff options
context:
space:
mode:
authorJeff Ames2008-02-05 19:44:27 +0000
committerJeff Ames2008-02-05 19:44:27 +0000
commit6ed5283bc06a62f38eb517e67b975832b603bf61 (patch)
treee5f635018789b73a99ddeca0883a68368fa5eece /OpenSim/Framework/ConfigurationMember.cs
parentCut down on the number of packets sent during terraforming. Terraforming shou... (diff)
downloadopensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.zip
opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.gz
opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.bz2
opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.xz
Converted logging to use log4net.
Changed LogBase to ConsoleBase, which handles console I/O. This is mostly an in-place conversion, so lots of refactoring can still be done.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/ConfigurationMember.cs52
1 files changed, 25 insertions, 27 deletions
diff --git a/OpenSim/Framework/ConfigurationMember.cs b/OpenSim/Framework/ConfigurationMember.cs
index 7590495..921fb66 100644
--- a/OpenSim/Framework/ConfigurationMember.cs
+++ b/OpenSim/Framework/ConfigurationMember.cs
@@ -39,6 +39,8 @@ namespace OpenSim.Framework
39{ 39{
40 public class ConfigurationMember 40 public class ConfigurationMember
41 { 41 {
42 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
43
42 public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result); 44 public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result);
43 45
44 public delegate void ConfigurationOptionsLoad(); 46 public delegate void ConfigurationOptionsLoad();
@@ -110,7 +112,7 @@ namespace OpenSim.Framework
110 } 112 }
111 else 113 else
112 { 114 {
113 MainLog.Instance.Notice( 115 m_log.Info(
114 "Required fields for adding a configuration option is invalid. Will not add this option (" + 116 "Required fields for adding a configuration option is invalid. Will not add this option (" +
115 option.configurationKey + ")"); 117 option.configurationKey + ")");
116 } 118 }
@@ -147,46 +149,44 @@ namespace OpenSim.Framework
147 checkAndAddConfigOption(configOption); 149 checkAndAddConfigOption(configOption);
148 } 150 }
149 151
150
151 // TEMP - REMOVE 152 // TEMP - REMOVE
152 private int cE = 0; 153 private int cE = 0;
153 public void performConfigurationRetrieve() 154 public void performConfigurationRetrieve()
154 { 155 {
155 if (cE > 1) 156 if (cE > 1)
156 MainLog.Instance.Error("READING CONFIGURATION COUT: " + cE.ToString()); 157 m_log.Error("READING CONFIGURATION COUT: " + cE.ToString());
157 158
158 159
159 configurationPlugin = LoadConfigDll(configurationPluginFilename); 160 configurationPlugin = LoadConfigDll(configurationPluginFilename);
160 configurationOptions.Clear(); 161 configurationOptions.Clear();
161 if (loadFunction == null) 162 if (loadFunction == null)
162 { 163 {
163 MainLog.Instance.Error("Load Function for '" + configurationDescription + 164 m_log.Error("Load Function for '" + configurationDescription +
164 "' is null. Refusing to run configuration."); 165 "' is null. Refusing to run configuration.");
165 return; 166 return;
166 } 167 }
167 168
168 if (resultFunction == null) 169 if (resultFunction == null)
169 { 170 {
170 MainLog.Instance.Error("Result Function for '" + configurationDescription + 171 m_log.Error("Result Function for '" + configurationDescription +
171 "' is null. Refusing to run configuration."); 172 "' is null. Refusing to run configuration.");
172 return; 173 return;
173 } 174 }
174 175
175 MainLog.Instance.Verbose("CONFIG", "Calling Configuration Load Function..."); 176 m_log.Info("[CONFIG]: Calling Configuration Load Function...");
176 loadFunction(); 177 loadFunction();
177 178
178 if (configurationOptions.Count <= 0) 179 if (configurationOptions.Count <= 0)
179 { 180 {
180 MainLog.Instance.Error("CONFIG", 181 m_log.Error("[CONFIG]: No configuration options were specified for '" + configurationOptions +
181 "No configuration options were specified for '" + configurationOptions + 182 "'. Refusing to continue configuration.");
182 "'. Refusing to continue configuration.");
183 return; 183 return;
184 } 184 }
185 185
186 bool useFile = true; 186 bool useFile = true;
187 if (configurationPlugin == null) 187 if (configurationPlugin == null)
188 { 188 {
189 MainLog.Instance.Error("CONFIG", "Configuration Plugin NOT LOADED!"); 189 m_log.Error("[CONFIG]: Configuration Plugin NOT LOADED!");
190 return; 190 return;
191 } 191 }
192 192
@@ -200,7 +200,7 @@ namespace OpenSim.Framework
200 } 200 }
201 catch (XmlException e) 201 catch (XmlException e)
202 { 202 {
203 MainLog.Instance.Error("Error loading " + configurationFilename + ": " + e.ToString()); 203 m_log.Error("Error loading " + configurationFilename + ": " + e.ToString());
204 useFile = false; 204 useFile = false;
205 } 205 }
206 } 206 }
@@ -208,11 +208,11 @@ namespace OpenSim.Framework
208 { 208 {
209 if (configurationFromXMLNode != null) 209 if (configurationFromXMLNode != null)
210 { 210 {
211 MainLog.Instance.Notice("Loading from XML Node, will not save to the file"); 211 m_log.Info("Loading from XML Node, will not save to the file");
212 configurationPlugin.LoadDataFromString(configurationFromXMLNode.OuterXml); 212 configurationPlugin.LoadDataFromString(configurationFromXMLNode.OuterXml);
213 } 213 }
214 214
215 MainLog.Instance.Notice("XML Configuration Filename is not valid; will not save to the file."); 215 m_log.Info("XML Configuration Filename is not valid; will not save to the file.");
216 useFile = false; 216 useFile = false;
217 } 217 }
218 218
@@ -253,15 +253,15 @@ namespace OpenSim.Framework
253 if (configurationDescription.Trim() != String.Empty) 253 if (configurationDescription.Trim() != String.Empty)
254 { 254 {
255 console_result = 255 console_result =
256 MainLog.Instance.CmdPrompt( 256 MainConsole.Instance.CmdPrompt(
257 configurationDescription + ": " + configOption.configurationQuestion, 257 configurationDescription + ": " + configOption.configurationQuestion,
258 configOption.configurationDefault); 258 configOption.configurationDefault);
259 } 259 }
260 else 260 else
261 { 261 {
262 console_result = 262 console_result =
263 MainLog.Instance.CmdPrompt(configOption.configurationQuestion, 263 MainConsole.Instance.CmdPrompt(configOption.configurationQuestion,
264 configOption.configurationDefault); 264 configOption.configurationDefault);
265 } 265 }
266 } 266 }
267 else 267 else
@@ -431,7 +431,7 @@ namespace OpenSim.Framework
431 431
432 if (!resultFunction(configOption.configurationKey, return_result)) 432 if (!resultFunction(configOption.configurationKey, return_result))
433 { 433 {
434 MainLog.Instance.Notice( 434 m_log.Info(
435 "The handler for the last configuration option denied that input, please try again."); 435 "The handler for the last configuration option denied that input, please try again.");
436 convertSuccess = false; 436 convertSuccess = false;
437 ignoreNextFromConfig = true; 437 ignoreNextFromConfig = true;
@@ -441,20 +441,18 @@ namespace OpenSim.Framework
441 { 441 {
442 if (configOption.configurationUseDefaultNoPrompt) 442 if (configOption.configurationUseDefaultNoPrompt)
443 { 443 {
444 MainLog.Instance.Error("CONFIG", 444 m_log.Error(string.Format(
445 string.Format( 445 "[CONFIG]: [{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n",
446 "[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", 446 configOption.configurationKey, console_result, errorMessage,
447 configOption.configurationKey, console_result, errorMessage, 447 configurationFilename));
448 configurationFilename));
449 convertSuccess = true; 448 convertSuccess = true;
450 } 449 }
451 else 450 else
452 { 451 {
453 MainLog.Instance.Warn("CONFIG", 452 m_log.Warn(string.Format(
454 string.Format( 453 "[CONFIG]: [{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n",
455 "[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", 454 configOption.configurationKey, console_result, errorMessage,
456 configOption.configurationKey, console_result, errorMessage, 455 configurationFilename));
457 configurationFilename));
458 ignoreNextFromConfig = true; 456 ignoreNextFromConfig = true;
459 } 457 }
460 } 458 }