diff options
author | Jeff Ames | 2008-02-05 19:44:27 +0000 |
---|---|---|
committer | Jeff Ames | 2008-02-05 19:44:27 +0000 |
commit | 6ed5283bc06a62f38eb517e67b975832b603bf61 (patch) | |
tree | e5f635018789b73a99ddeca0883a68368fa5eece /OpenSim/Grid/GridServer/GridManager.cs | |
parent | Cut down on the number of packets sent during terraforming. Terraforming shou... (diff) | |
download | opensim-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 'OpenSim/Grid/GridServer/GridManager.cs')
-rw-r--r-- | OpenSim/Grid/GridServer/GridManager.cs | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index c956a01..49b9aa2 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs | |||
@@ -38,11 +38,12 @@ using OpenSim.Framework.Console; | |||
38 | using OpenSim.Framework.Data; | 38 | using OpenSim.Framework.Data; |
39 | using OpenSim.Framework.Servers; | 39 | using OpenSim.Framework.Servers; |
40 | 40 | ||
41 | |||
42 | namespace OpenSim.Grid.GridServer | 41 | namespace OpenSim.Grid.GridServer |
43 | { | 42 | { |
44 | internal class GridManager | 43 | internal class GridManager |
45 | { | 44 | { |
45 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
46 | private Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); | 47 | private Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); |
47 | private Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); | 48 | private Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); |
48 | 49 | ||
@@ -57,10 +58,10 @@ namespace OpenSim.Grid.GridServer | |||
57 | /// <param name="FileName">The filename to the grid server plugin DLL</param> | 58 | /// <param name="FileName">The filename to the grid server plugin DLL</param> |
58 | public void AddPlugin(string FileName) | 59 | public void AddPlugin(string FileName) |
59 | { | 60 | { |
60 | MainLog.Instance.Verbose("DATA", "Attempting to load " + FileName); | 61 | m_log.Info("[DATA]: Attempting to load " + FileName); |
61 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 62 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); |
62 | 63 | ||
63 | MainLog.Instance.Verbose("DATA", "Found " + pluginAssembly.GetTypes().Length + " interfaces."); | 64 | m_log.Info("[DATA]: Found " + pluginAssembly.GetTypes().Length + " interfaces."); |
64 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 65 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
65 | { | 66 | { |
66 | if (!pluginType.IsAbstract) | 67 | if (!pluginType.IsAbstract) |
@@ -74,7 +75,7 @@ namespace OpenSim.Grid.GridServer | |||
74 | (IGridData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 75 | (IGridData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
75 | plug.Initialise(); | 76 | plug.Initialise(); |
76 | _plugins.Add(plug.getName(), plug); | 77 | _plugins.Add(plug.getName(), plug); |
77 | MainLog.Instance.Verbose("DATA", "Added IGridData Interface"); | 78 | m_log.Info("[DATA]: Added IGridData Interface"); |
78 | } | 79 | } |
79 | 80 | ||
80 | typeInterface = null; | 81 | typeInterface = null; |
@@ -88,7 +89,7 @@ namespace OpenSim.Grid.GridServer | |||
88 | (ILogData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 89 | (ILogData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
89 | plug.Initialise(); | 90 | plug.Initialise(); |
90 | _logplugins.Add(plug.getName(), plug); | 91 | _logplugins.Add(plug.getName(), plug); |
91 | MainLog.Instance.Verbose("DATA", "Added ILogData Interface"); | 92 | m_log.Info("[DATA]: Added ILogData Interface"); |
92 | } | 93 | } |
93 | 94 | ||
94 | typeInterface = null; | 95 | typeInterface = null; |
@@ -116,7 +117,7 @@ namespace OpenSim.Grid.GridServer | |||
116 | } | 117 | } |
117 | catch (Exception) | 118 | catch (Exception) |
118 | { | 119 | { |
119 | MainLog.Instance.Warn("storage", "Unable to write log via " + kvp.Key); | 120 | m_log.Warn("[storage]: Unable to write log via " + kvp.Key); |
120 | } | 121 | } |
121 | } | 122 | } |
122 | } | 123 | } |
@@ -136,7 +137,7 @@ namespace OpenSim.Grid.GridServer | |||
136 | } | 137 | } |
137 | catch (Exception e) | 138 | catch (Exception e) |
138 | { | 139 | { |
139 | MainLog.Instance.Warn("storage", "getRegion - " + e.Message); | 140 | m_log.Warn("[storage]: getRegion - " + e.Message); |
140 | } | 141 | } |
141 | } | 142 | } |
142 | return null; | 143 | return null; |
@@ -157,7 +158,7 @@ namespace OpenSim.Grid.GridServer | |||
157 | } | 158 | } |
158 | catch | 159 | catch |
159 | { | 160 | { |
160 | MainLog.Instance.Warn("storage", "Unable to find region " + handle.ToString() + " via " + kvp.Key); | 161 | m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " via " + kvp.Key); |
161 | } | 162 | } |
162 | } | 163 | } |
163 | return null; | 164 | return null; |
@@ -179,7 +180,7 @@ namespace OpenSim.Grid.GridServer | |||
179 | } | 180 | } |
180 | catch | 181 | catch |
181 | { | 182 | { |
182 | MainLog.Instance.Warn("storage", "Unable to query regionblock via " + kvp.Key); | 183 | m_log.Warn("[storage]: Unable to query regionblock via " + kvp.Key); |
183 | } | 184 | } |
184 | } | 185 | } |
185 | 186 | ||
@@ -245,14 +246,14 @@ namespace OpenSim.Grid.GridServer | |||
245 | } | 246 | } |
246 | else | 247 | else |
247 | { | 248 | { |
248 | MainLog.Instance.Verbose("GRID", "Region connected without a UUID, ignoring."); | 249 | m_log.Info("[GRID]: Region connected without a UUID, ignoring."); |
249 | responseData["error"] = "No UUID passed to grid server - unable to connect you"; | 250 | responseData["error"] = "No UUID passed to grid server - unable to connect you"; |
250 | return response; | 251 | return response; |
251 | } | 252 | } |
252 | 253 | ||
253 | if (TheSim == null) // Shouldnt this be in the REST Simulator Set method? | 254 | if (TheSim == null) // Shouldnt this be in the REST Simulator Set method? |
254 | { | 255 | { |
255 | MainLog.Instance.Verbose("GRID", "New region connecting"); | 256 | m_log.Info("[GRID]: New region connecting"); |
256 | myword = "creation"; | 257 | myword = "creation"; |
257 | } | 258 | } |
258 | else | 259 | else |
@@ -320,7 +321,7 @@ namespace OpenSim.Grid.GridServer | |||
320 | (OldSim.regionRecvKey == TheSim.regionRecvKey && | 321 | (OldSim.regionRecvKey == TheSim.regionRecvKey && |
321 | OldSim.regionSendKey == TheSim.regionSendKey)) | 322 | OldSim.regionSendKey == TheSim.regionSendKey)) |
322 | { | 323 | { |
323 | MainLog.Instance.Verbose("GRID", "Adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + | 324 | m_log.Info("[GRID]: Adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + |
324 | TheSim.serverURI); | 325 | TheSim.serverURI); |
325 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | 326 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) |
326 | { | 327 | { |
@@ -330,17 +331,17 @@ namespace OpenSim.Grid.GridServer | |||
330 | switch (insertResponse) | 331 | switch (insertResponse) |
331 | { | 332 | { |
332 | case DataResponse.RESPONSE_OK: | 333 | case DataResponse.RESPONSE_OK: |
333 | MainLog.Instance.Verbose("grid", "New sim " + myword + " successful: " + TheSim.regionName); | 334 | m_log.Info("[grid]: New sim " + myword + " successful: " + TheSim.regionName); |
334 | break; | 335 | break; |
335 | case DataResponse.RESPONSE_ERROR: | 336 | case DataResponse.RESPONSE_ERROR: |
336 | MainLog.Instance.Warn("storage", "New sim creation failed (Error): " + TheSim.regionName); | 337 | m_log.Warn("[storage]: New sim creation failed (Error): " + TheSim.regionName); |
337 | break; | 338 | break; |
338 | case DataResponse.RESPONSE_INVALIDCREDENTIALS: | 339 | case DataResponse.RESPONSE_INVALIDCREDENTIALS: |
339 | MainLog.Instance.Warn("storage", | 340 | m_log.Warn("[storage]: " + |
340 | "New sim creation failed (Invalid Credentials): " + TheSim.regionName); | 341 | "New sim creation failed (Invalid Credentials): " + TheSim.regionName); |
341 | break; | 342 | break; |
342 | case DataResponse.RESPONSE_AUTHREQUIRED: | 343 | case DataResponse.RESPONSE_AUTHREQUIRED: |
343 | MainLog.Instance.Warn("storage", | 344 | m_log.Warn("[storage]: " + |
344 | "New sim creation failed (Authentication Required): " + | 345 | "New sim creation failed (Authentication Required): " + |
345 | TheSim.regionName); | 346 | TheSim.regionName); |
346 | break; | 347 | break; |
@@ -348,9 +349,9 @@ namespace OpenSim.Grid.GridServer | |||
348 | } | 349 | } |
349 | catch (Exception e) | 350 | catch (Exception e) |
350 | { | 351 | { |
351 | MainLog.Instance.Warn("storage", | 352 | m_log.Warn("[storage]: " + |
352 | "Unable to add region " + TheSim.UUID.ToString() + " via " + kvp.Key); | 353 | "Unable to add region " + TheSim.UUID.ToString() + " via " + kvp.Key); |
353 | MainLog.Instance.Warn("storage", e.ToString()); | 354 | m_log.Warn("[storage]: " + e.ToString()); |
354 | } | 355 | } |
355 | 356 | ||
356 | 357 | ||
@@ -458,14 +459,14 @@ namespace OpenSim.Grid.GridServer | |||
458 | } | 459 | } |
459 | else | 460 | else |
460 | { | 461 | { |
461 | MainLog.Instance.Warn("grid", "Authentication failed when trying to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName); | 462 | m_log.Warn("[grid]: Authentication failed when trying to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName); |
462 | responseData["error"] = "The key required to connect to your region did not match. Please check your send and recieve keys."; | 463 | responseData["error"] = "The key required to connect to your region did not match. Please check your send and recieve keys."; |
463 | return response; | 464 | return response; |
464 | } | 465 | } |
465 | } | 466 | } |
466 | else | 467 | else |
467 | { | 468 | { |
468 | MainLog.Instance.Warn("grid", "Failed to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName); | 469 | m_log.Warn("[grid]: Failed to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName); |
469 | responseData["error"] = "Another region already exists at that location. Try another"; | 470 | responseData["error"] = "Another region already exists at that location. Try another"; |
470 | return response; | 471 | return response; |
471 | } | 472 | } |
@@ -496,7 +497,7 @@ namespace OpenSim.Grid.GridServer | |||
496 | } | 497 | } |
497 | else | 498 | else |
498 | { | 499 | { |
499 | MainLog.Instance.Verbose("DATA", "found " + (string) simData.regionName + " regionHandle = " + | 500 | m_log.Info("[DATA]: found " + (string) simData.regionName + " regionHandle = " + |
500 | (string) requestData["region_handle"]); | 501 | (string) requestData["region_handle"]); |
501 | responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); | 502 | responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); |
502 | responseData["sim_port"] = simData.serverPort.ToString(); | 503 | responseData["sim_port"] = simData.serverPort.ToString(); |
@@ -535,8 +536,8 @@ namespace OpenSim.Grid.GridServer | |||
535 | { | 536 | { |
536 | ymax = (Int32) requestData["ymax"]; | 537 | ymax = (Int32) requestData["ymax"]; |
537 | } | 538 | } |
538 | //CFK: The second MainLog is more meaningful and either standard or fast generally occurs. | 539 | //CFK: The second log is more meaningful and either standard or fast generally occurs. |
539 | //CFK: MainLog.Instance.Verbose("MAP", "World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); | 540 | //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); |
540 | 541 | ||
541 | XmlRpcResponse response = new XmlRpcResponse(); | 542 | XmlRpcResponse response = new XmlRpcResponse(); |
542 | Hashtable responseData = new Hashtable(); | 543 | Hashtable responseData = new Hashtable(); |
@@ -575,7 +576,7 @@ namespace OpenSim.Grid.GridServer | |||
575 | 576 | ||
576 | simProfileList.Add(simProfileBlock); | 577 | simProfileList.Add(simProfileBlock); |
577 | } | 578 | } |
578 | MainLog.Instance.Verbose("MAP", "Fast map " + simProfileList.Count.ToString() + | 579 | m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() + |
579 | " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); | 580 | " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); |
580 | } | 581 | } |
581 | else | 582 | else |
@@ -610,7 +611,7 @@ namespace OpenSim.Grid.GridServer | |||
610 | } | 611 | } |
611 | } | 612 | } |
612 | } | 613 | } |
613 | MainLog.Instance.Verbose("MAP", "Std map " + simProfileList.Count.ToString() + | 614 | m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() + |
614 | " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); | 615 | " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); |
615 | } | 616 | } |
616 | 617 | ||
@@ -776,7 +777,7 @@ namespace OpenSim.Grid.GridServer | |||
776 | 777 | ||
777 | try | 778 | try |
778 | { | 779 | { |
779 | MainLog.Instance.Verbose("DATA", | 780 | m_log.Info("[DATA]: " + |
780 | "Updating / adding via " + _plugins.Count + " storage provider(s) registered."); | 781 | "Updating / adding via " + _plugins.Count + " storage provider(s) registered."); |
781 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | 782 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) |
782 | { | 783 | { |
@@ -789,13 +790,13 @@ namespace OpenSim.Grid.GridServer | |||
789 | (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey)) | 790 | (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey)) |
790 | { | 791 | { |
791 | kvp.Value.AddProfile(TheSim); | 792 | kvp.Value.AddProfile(TheSim); |
792 | MainLog.Instance.Verbose("grid", "New sim added to grid (" + TheSim.regionName + ")"); | 793 | m_log.Info("[grid]: New sim added to grid (" + TheSim.regionName + ")"); |
793 | logToDB(TheSim.UUID.ToString(), "RestSetSimMethod", String.Empty, 5, | 794 | logToDB(TheSim.UUID.ToString(), "RestSetSimMethod", String.Empty, 5, |
794 | "Region successfully updated and connected to grid."); | 795 | "Region successfully updated and connected to grid."); |
795 | } | 796 | } |
796 | else | 797 | else |
797 | { | 798 | { |
798 | MainLog.Instance.Warn("grid", | 799 | m_log.Warn("[grid]: " + |
799 | "Unable to update region (RestSetSimMethod): Incorrect reservation auth key."); | 800 | "Unable to update region (RestSetSimMethod): Incorrect reservation auth key."); |
800 | // Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); | 801 | // Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); |
801 | return "Unable to update region (RestSetSimMethod): Incorrect auth key."; | 802 | return "Unable to update region (RestSetSimMethod): Incorrect auth key."; |
@@ -803,7 +804,7 @@ namespace OpenSim.Grid.GridServer | |||
803 | } | 804 | } |
804 | catch (Exception e) | 805 | catch (Exception e) |
805 | { | 806 | { |
806 | MainLog.Instance.Warn("GRID", "getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + | 807 | m_log.Warn("[GRID]: getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + |
807 | e.ToString()); | 808 | e.ToString()); |
808 | } | 809 | } |
809 | } | 810 | } |