diff options
Refactor log4net logger handling in script engine. (#3148)
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs index 01cbb72..5451df2 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs | |||
@@ -47,6 +47,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
47 | // within a class | 47 | // within a class |
48 | public class EventQueueThreadClass | 48 | public class EventQueueThreadClass |
49 | { | 49 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
51 | |||
50 | // How many ms to sleep if queue is empty | 52 | // How many ms to sleep if queue is empty |
51 | private static int nothingToDoSleepms;// = 50; | 53 | private static int nothingToDoSleepms;// = 50; |
52 | private static ThreadPriority MyThreadPriority; | 54 | private static ThreadPriority MyThreadPriority; |
@@ -110,11 +112,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
110 | break; | 112 | break; |
111 | default: | 113 | default: |
112 | MyThreadPriority = ThreadPriority.BelowNormal; | 114 | MyThreadPriority = ThreadPriority.BelowNormal; |
113 | m_ScriptEngine.Log.Error( | 115 | m_log.Error( |
114 | "[ScriptEngine.DotNetEngine]: Unknown "+ | 116 | "[ScriptEngine.DotNetEngine]: Unknown "+ |
115 | "priority type \"" + pri + | 117 | "priority type \"" + pri + |
116 | "\" in config file. Defaulting to "+ | 118 | "\" in config file. Defaulting to "+ |
117 | "\"BelowNormal\"."); | 119 | "\"BelowNormal\"."); |
118 | break; | 120 | break; |
119 | } | 121 | } |
120 | } | 122 | } |
@@ -186,24 +188,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
186 | } | 188 | } |
187 | catch (ThreadAbortException) | 189 | catch (ThreadAbortException) |
188 | { | 190 | { |
189 | if (lastScriptEngine != null) | 191 | m_log.Info("[" + ScriptEngineName + |
190 | lastScriptEngine.Log.Info("[" + ScriptEngineName + | 192 | "]: ThreadAbortException while executing "+ |
191 | "]: ThreadAbortException while executing "+ | 193 | "function."); |
192 | "function."); | ||
193 | } | 194 | } |
194 | catch (SelfDeleteException) // Must delete SOG | 195 | catch (SelfDeleteException) // Must delete SOG |
195 | { | 196 | { |
196 | SceneObjectPart part = | 197 | SceneObjectPart part = |
197 | lastScriptEngine.World.GetSceneObjectPart( | 198 | lastScriptEngine.World.GetSceneObjectPart( |
198 | lastLocalID); | 199 | lastLocalID); |
199 | if (part != null && part.ParentGroup != null) | 200 | if (part != null && part.ParentGroup != null) |
200 | lastScriptEngine.World.DeleteSceneObject( | 201 | lastScriptEngine.World.DeleteSceneObject( |
201 | part.ParentGroup, false); | 202 | part.ParentGroup, false); |
202 | } | 203 | } |
203 | catch (Exception e) | 204 | catch (Exception e) |
204 | { | 205 | { |
205 | if (lastScriptEngine != null) | 206 | m_log.ErrorFormat("[{0}]: Exception {1} thrown", ScriptEngineName, e.GetType().ToString()); |
206 | lastScriptEngine.Log.ErrorFormat("[{0}]: Exception {1} thrown", ScriptEngineName, e.GetType().ToString()); | ||
207 | throw e; | 207 | throw e; |
208 | } | 208 | } |
209 | } | 209 | } |
@@ -214,10 +214,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
214 | catch (Exception e) | 214 | catch (Exception e) |
215 | { | 215 | { |
216 | // TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened | 216 | // TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened |
217 | if (lastScriptEngine != null) | 217 | m_log.ErrorFormat( |
218 | lastScriptEngine.Log.ErrorFormat( | 218 | "[{0}]: Event queue thread terminating with exception. PLEASE REBOOT YOUR SIM - SCRIPT EVENTS WILL NOT WORK UNTIL YOU DO. Exception is {1}", |
219 | "[{0}]: Event queue thread terminating with exception. PLEASE REBOOT YOUR SIM - SCRIPT EVENTS WILL NOT WORK UNTIL YOU DO. Exception is {1}", | 219 | ScriptEngineName, e); |
220 | ScriptEngineName, e); | ||
221 | } | 220 | } |
222 | } | 221 | } |
223 | 222 | ||
@@ -342,11 +341,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
342 | } | 341 | } |
343 | catch (Exception) | 342 | catch (Exception) |
344 | { | 343 | { |
345 | m_ScriptEngine.m_EventQueueManager. | 344 | m_log.Error("[" + |
346 | m_ScriptEngine.Log.Error("[" + | 345 | ScriptEngineName + "]: " + |
347 | ScriptEngineName + "]: " + | 346 | "Unable to send text in-world:\r\n" + |
348 | "Unable to send text in-world:\r\n" + | 347 | text); |
349 | text); | ||
350 | } | 348 | } |
351 | finally | 349 | finally |
352 | { | 350 | { |