aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJeff Ames2009-02-22 01:26:18 +0000
committerJeff Ames2009-02-22 01:26:18 +0000
commit818af9d4827ea66358abbc3929d20e09861c7306 (patch)
tree097254f7d203fff8547c30061540bc01e4f84d12
parentAddresses some issues with appearance after TPs. Appearance.Owner was not bei... (diff)
downloadopensim-SC_OLD-818af9d4827ea66358abbc3929d20e09861c7306.zip
opensim-SC_OLD-818af9d4827ea66358abbc3929d20e09861c7306.tar.gz
opensim-SC_OLD-818af9d4827ea66358abbc3929d20e09861c7306.tar.bz2
opensim-SC_OLD-818af9d4827ea66358abbc3929d20e09861c7306.tar.xz
Refactor log4net logger handling in script engine. (#3148)
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs16
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs16
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs42
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs51
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs44
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs36
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs7
-rw-r--r--OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs1
-rw-r--r--OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs1
-rw-r--r--OpenSim/ScriptEngine/Shared/ScriptStructure.cs12
18 files changed, 141 insertions, 133 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
index eeca143..d35e585 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
@@ -34,6 +34,7 @@ using System.Security.Policy;
34using System.Security.Permissions; 34using System.Security.Permissions;
35using OpenSim.Region.ScriptEngine.Interfaces; 35using OpenSim.Region.ScriptEngine.Interfaces;
36using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 36using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
37using log4net;
37 38
38namespace OpenSim.Region.ScriptEngine.DotNetEngine 39namespace OpenSim.Region.ScriptEngine.DotNetEngine
39{ 40{
@@ -51,6 +52,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
51 // 4. Unload AppDomain completely when all scripts in it has stopped 52 // 4. Unload AppDomain completely when all scripts in it has stopped
52 // 53 //
53 54
55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
56
54 private int maxScriptsPerAppDomain = 1; 57 private int maxScriptsPerAppDomain = 1;
55 58
56 // Internal list of all AppDomains 59 // Internal list of all AppDomains
@@ -138,12 +141,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
138 AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + 141 AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" +
139 AppDomainNameCount, null, ads); 142 AppDomainNameCount, null, ads);
140 143
141 m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + 144 m_log.Info("[" + m_scriptEngine.ScriptEngineName +
142 "]: AppDomain Loading: " + 145 "]: AppDomain Loading: " +
143 AssemblyName.GetAssemblyName( 146 AssemblyName.GetAssemblyName(
144 "OpenSim.Region.ScriptEngine.Shared.dll").ToString()); 147 "OpenSim.Region.ScriptEngine.Shared.dll").ToString());
145 AD.Load(AssemblyName.GetAssemblyName( 148 AD.Load(AssemblyName.GetAssemblyName(
146 "OpenSim.Region.ScriptEngine.Shared.dll")); 149 "OpenSim.Region.ScriptEngine.Shared.dll"));
147 150
148 // Return the new AppDomain 151 // Return the new AppDomain
149 return AD; 152 return AD;
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
index 56b4c8e..f10722b 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
@@ -25,22 +25,27 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Reflection;
29using log4net;
30
28namespace OpenSim.Region.ScriptEngine.DotNetEngine 31namespace OpenSim.Region.ScriptEngine.DotNetEngine
29{ 32{
30 public static class Common 33 public static class Common
31 { 34 {
35 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
36
32 public static ScriptEngine mySE; 37 public static ScriptEngine mySE;
33 38
34 // This class just contains some static log stuff used for debugging. 39 // This class just contains some static log stuff used for debugging.
35 40
36 public static void SendToDebug(string message) 41 public static void SendToDebug(string message)
37 { 42 {
38 mySE.Log.Info("[" + mySE.ScriptEngineName + "]: Debug: " + message); 43 m_log.Info("[" + mySE.ScriptEngineName + "]: Debug: " + message);
39 } 44 }
40 45
41 public static void SendToLog(string message) 46 public static void SendToLog(string message)
42 { 47 {
43 mySE.Log.Info("[" + mySE.ScriptEngineName + "]: LOG: " + message); 48 m_log.Info("[" + mySE.ScriptEngineName + "]: LOG: " + message);
44 } 49 }
45 } 50 }
46} 51}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
index cc78b51..e55abb7 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
30using OpenMetaverse; 31using OpenMetaverse;
31using OpenSim.Framework; 32using OpenSim.Framework;
32using OpenSim.Region.CoreModules.Avatar.Currency.SampleMoney; 33using OpenSim.Region.CoreModules.Avatar.Currency.SampleMoney;
@@ -35,6 +36,7 @@ using OpenSim.Region;
35using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.ScriptEngine.Shared; 38using OpenSim.Region.ScriptEngine.Shared;
39using log4net;
38 40
39namespace OpenSim.Region.ScriptEngine.DotNetEngine 41namespace OpenSim.Region.ScriptEngine.DotNetEngine
40{ 42{
@@ -63,6 +65,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
63 // verify what exact parameters are needed. 65 // verify what exact parameters are needed.
64 // 66 //
65 67
68 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
69
66 private ScriptEngine myScriptEngine; 70 private ScriptEngine myScriptEngine;
67 71
68 public EventManager(ScriptEngine _ScriptEngine, bool performHookUp) 72 public EventManager(ScriptEngine _ScriptEngine, bool performHookUp)
@@ -78,8 +82,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
78 82
79 public void HookUpEvents() 83 public void HookUpEvents()
80 { 84 {
81 myScriptEngine.Log.Info("[" + myScriptEngine.ScriptEngineName + 85 m_log.Info("[" + myScriptEngine.ScriptEngineName +
82 "]: Hooking up to server events"); 86 "]: Hooking up to server events");
83 87
84 myScriptEngine.World.EventManager.OnObjectGrab += 88 myScriptEngine.World.EventManager.OnObjectGrab +=
85 touch_start; 89 touch_start;
@@ -293,9 +297,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
293 if (engine != myScriptEngine.ScriptEngineName) 297 if (engine != myScriptEngine.ScriptEngineName)
294 return; 298 return;
295 299
296 myScriptEngine.Log.Debug("OnRezScript localID: " + localID + 300 m_log.Debug("OnRezScript localID: " + localID +
297 " LLUID: " + itemID.ToString() + " Size: " + 301 " LLUID: " + itemID.ToString() + " Size: " +
298 script.Length); 302 script.Length);
299 303
300 myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script, 304 myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script,
301 startParam, postOnRez); 305 startParam, postOnRez);
@@ -303,7 +307,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
303 307
304 public void OnRemoveScript(uint localID, UUID itemID) 308 public void OnRemoveScript(uint localID, UUID itemID)
305 { 309 {
306 myScriptEngine.Log.Debug("OnRemoveScript localID: " + localID + " LLUID: " + itemID.ToString()); 310 m_log.Debug("OnRemoveScript localID: " + localID + " LLUID: " + itemID.ToString());
307 myScriptEngine.m_ScriptManager.StopScript( 311 myScriptEngine.m_ScriptManager.StopScript(
308 localID, 312 localID,
309 itemID 313 itemID
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
index 4a094e2..31c0d4d 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
@@ -28,8 +28,10 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Region.ScriptEngine.Shared; 33using OpenSim.Region.ScriptEngine.Shared;
34using log4net;
33 35
34namespace OpenSim.Region.ScriptEngine.DotNetEngine 36namespace OpenSim.Region.ScriptEngine.DotNetEngine
35{ 37{
@@ -58,6 +60,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
58 // Not noticeable unless server is under high load. 60 // Not noticeable unless server is under high load.
59 // 61 //
60 62
63 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
64
61 public ScriptEngine m_ScriptEngine; 65 public ScriptEngine m_ScriptEngine;
62 66
63 /// <summary> 67 /// <summary>
@@ -211,7 +215,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
211 { 215 {
212 EventQueueThreadClass eqtc = new EventQueueThreadClass(); 216 EventQueueThreadClass eqtc = new EventQueueThreadClass();
213 eventQueueThreads.Add(eqtc); 217 eventQueueThreads.Add(eqtc);
214 //m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Started new script execution thread. Current thread count: " + eventQueueThreads.Count); 218 //m_log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Started new script execution thread. Current thread count: " + eventQueueThreads.Count);
215 } 219 }
216 220
217 private void AbortThreadClass(EventQueueThreadClass threadClass) 221 private void AbortThreadClass(EventQueueThreadClass threadClass)
@@ -225,10 +229,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
225 } 229 }
226 catch (Exception) 230 catch (Exception)
227 { 231 {
228 //m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: If you see this, could you please report it to Tedd:"); 232 //m_log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: If you see this, could you please report it to Tedd:");
229 //m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: Script thread execution timeout kill ended in exception: " + ex.ToString()); 233 //m_log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: Script thread execution timeout kill ended in exception: " + ex.ToString());
230 } 234 }
231 //m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Killed script execution thread. Remaining thread count: " + eventQueueThreads.Count); 235 //m_log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Killed script execution thread. Remaining thread count: " + eventQueueThreads.Count);
232 } 236 }
233 #endregion 237 #endregion
234 238
@@ -346,8 +350,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
346 { 350 {
347 if (eventQueue.Count >= EventExecutionMaxQueueSize) 351 if (eventQueue.Count >= EventExecutionMaxQueueSize)
348 { 352 {
349 m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: ERROR: Event execution queue item count is at " + eventQueue.Count + ". Config variable \"EventExecutionMaxQueueSize\" is set to " + EventExecutionMaxQueueSize + ", so ignoring new event."); 353 m_log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: ERROR: Event execution queue item count is at " + eventQueue.Count + ". Config variable \"EventExecutionMaxQueueSize\" is set to " + EventExecutionMaxQueueSize + ", so ignoring new event.");
350 m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); 354 m_log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
351 return false; 355 return false;
352 } 356 }
353 357
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 {
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs
index 49e87c0..c157509 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
107 private void StopMaintenanceThread() 107 private void StopMaintenanceThread()
108 { 108 {
109#if DEBUG 109#if DEBUG
110 //m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: StopMaintenanceThread() called"); 110 //m_log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: StopMaintenanceThread() called");
111#endif 111#endif
112 //PleaseShutdown = true; 112 //PleaseShutdown = true;
113 Thread.Sleep(100); 113 Thread.Sleep(100);
@@ -120,7 +120,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
120 } 120 }
121 catch (Exception) 121 catch (Exception)
122 { 122 {
123 //m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Exception stopping maintenence thread: " + ex.ToString()); 123 //m_log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Exception stopping maintenence thread: " + ex.ToString());
124 } 124 }
125 } 125 }
126 126
@@ -131,8 +131,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
131 public void MaintenanceLoop() 131 public void MaintenanceLoop()
132 { 132 {
133 //if (m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens < MaintenanceLoopms) 133 //if (m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens < MaintenanceLoopms)
134 // m_ScriptEngine.Log.Warn("[" + m_ScriptEngine.ScriptEngineName + "]: " + 134 // m_log.Warn("[" + m_ScriptEngine.ScriptEngineName + "]: " +
135 // "Configuration error: MaxEventExecutionTimeMs is less than MaintenanceLoopms. The Maintenance Loop will only check scripts once per run."); 135 // "Configuration error: MaxEventExecutionTimeMs is less than MaintenanceLoopms. The Maintenance Loop will only check scripts once per run.");
136 136
137 long Last_maxFunctionExecutionTimens = 0; // DateTime.Now.Ticks; 137 long Last_maxFunctionExecutionTimens = 0; // DateTime.Now.Ticks;
138 long Last_ReReadConfigFilens = DateTime.Now.Ticks; 138 long Last_ReReadConfigFilens = DateTime.Now.Ticks;
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
index dc7716e..c1902ba 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
@@ -98,11 +98,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
98 get { return "ScriptEngine.DotNetEngine"; } 98 get { return "ScriptEngine.DotNetEngine"; }
99 } 99 }
100 100
101 public ILog Log
102 {
103 get { return m_log; }
104 }
105
106 public ScriptEngine() 101 public ScriptEngine()
107 { 102 {
108 // For logging, just need any instance, doesn't matter 103 // For logging, just need any instance, doesn't matter
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 0c06630..4ede7f1 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -240,14 +240,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
240 } 240 }
241 catch (Exception e2) // LEGIT: User Scripting 241 catch (Exception e2) // LEGIT: User Scripting
242 { 242 {
243 m_scriptEngine.Log.Error("[" + 243 m_log.Error("[" +
244 m_scriptEngine.ScriptEngineName + 244 m_scriptEngine.ScriptEngineName +
245 "]: Error displaying error in-world: " + 245 "]: Error displaying error in-world: " +
246 e2.ToString()); 246 e2.ToString());
247 m_scriptEngine.Log.Error("[" + 247 m_log.Error("[" +
248 m_scriptEngine.ScriptEngineName + "]: " + 248 m_scriptEngine.ScriptEngineName + "]: " +
249 "Errormessage: Error compiling script:\r\n" + 249 "Errormessage: Error compiling script:\r\n" +
250 e2.Message.ToString()); 250 e2.Message.ToString());
251 } 251 }
252 } 252 }
253 } 253 }
@@ -258,8 +258,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
258 if (id == null) 258 if (id == null)
259 return; 259 return;
260 260
261 m_scriptEngine.Log.DebugFormat("[{0}]: Unloading script", 261 m_log.DebugFormat("[{0}]: Unloading script",
262 m_scriptEngine.ScriptEngineName); 262 m_scriptEngine.ScriptEngineName);
263 263
264 // Stop long command on script 264 // Stop long command on script
265 AsyncCommandManager.RemoveScript(m_scriptEngine, localID, itemID); 265 AsyncCommandManager.RemoveScript(m_scriptEngine, localID, itemID);
@@ -280,11 +280,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
280 } 280 }
281 catch (Exception e) // LEGIT: User Scripting 281 catch (Exception e) // LEGIT: User Scripting
282 { 282 {
283 m_scriptEngine.Log.Error("[" + 283 m_log.Error("[" +
284 m_scriptEngine.ScriptEngineName + 284 m_scriptEngine.ScriptEngineName +
285 "]: Exception stopping script localID: " + 285 "]: Exception stopping script localID: " +
286 localID + " LLUID: " + itemID.ToString() + 286 localID + " LLUID: " + itemID.ToString() +
287 ": " + e.ToString()); 287 ": " + e.ToString());
288 } 288 }
289 } 289 }
290 290
@@ -379,10 +379,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
379 } 379 }
380 else if (item.Action == LUType.Load) 380 else if (item.Action == LUType.Load)
381 { 381 {
382 m_scriptEngine.Log.DebugFormat("[{0}]: Loading script", 382 m_log.DebugFormat("[{0}]: Loading script",
383 m_scriptEngine.ScriptEngineName); 383 m_scriptEngine.ScriptEngineName);
384 _StartScript(item.localID, item.itemID, item.script, 384 _StartScript(item.localID, item.itemID, item.script,
385 item.startParam, item.postOnRez); 385 item.startParam, item.postOnRez);
386 } 386 }
387 } 387 }
388 } 388 }
@@ -414,13 +414,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
414 { 414 {
415 if ((LUQueue.Count >= LoadUnloadMaxQueueSize) && m_started) 415 if ((LUQueue.Count >= LoadUnloadMaxQueueSize) && m_started)
416 { 416 {
417 m_scriptEngine.Log.Error("[" + 417 m_log.Error("[" +
418 m_scriptEngine.ScriptEngineName + 418 m_scriptEngine.ScriptEngineName +
419 "]: ERROR: Load/unload queue item count is at " + 419 "]: ERROR: Load/unload queue item count is at " +
420 LUQueue.Count + 420 LUQueue.Count +
421 ". Config variable \"LoadUnloadMaxQueueSize\" "+ 421 ". Config variable \"LoadUnloadMaxQueueSize\" "+
422 "is set to " + LoadUnloadMaxQueueSize + 422 "is set to " + LoadUnloadMaxQueueSize +
423 ", so ignoring new script."); 423 ", so ignoring new script.");
424
424 return; 425 return;
425 } 426 }
426 427
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
index 84baa64..95a8530 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
@@ -71,7 +71,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
71 void ResetScript(UUID itemID); 71 void ResetScript(UUID itemID);
72 IConfig Config { get; } 72 IConfig Config { get; }
73 string ScriptEngineName { get; } 73 string ScriptEngineName { get; }
74 ILog Log { get; }
75 IScriptApi GetApi(UUID itemID, string name); 74 IScriptApi GetApi(UUID itemID, string name);
76 } 75 }
77} 76}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 6282b16..5455b53 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -32,6 +32,7 @@ using System.Runtime.Remoting.Lifetime;
32using System.Text; 32using System.Text;
33using System.Threading; 33using System.Threading;
34using Nini.Config; 34using Nini.Config;
35using log4net;
35using OpenMetaverse; 36using OpenMetaverse;
36using OpenMetaverse.Packets; 37using OpenMetaverse.Packets;
37using OpenSim; 38using OpenSim;
@@ -80,7 +81,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
80 private bool m_automaticLinkPermission=false; 81 private bool m_automaticLinkPermission=false;
81 private IMessageTransferModule m_TransferModule = null; 82 private IMessageTransferModule m_TransferModule = null;
82 83
83 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 84 //private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
84 85
85 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) 86 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
86 { 87 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
index 5c95c66..5e5a922 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using log4net;
29using OpenMetaverse; 30using OpenMetaverse;
30using OpenSim.Region.Framework.Interfaces; 31using OpenSim.Region.Framework.Interfaces;
31using OpenSim.Region.CoreModules.Scripting.WorldComm; 32using OpenSim.Region.CoreModules.Scripting.WorldComm;
@@ -37,7 +38,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
37{ 38{
38 public class Listener 39 public class Listener
39 { 40 {
40 // private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 41 // private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
41 42
42 public AsyncCommandManager m_CmdManager; 43 public AsyncCommandManager m_CmdManager;
43 44
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 5b3dce7..03b2ab3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -29,10 +29,12 @@ using System;
29using System.CodeDom.Compiler; 29using System.CodeDom.Compiler;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Globalization; 31using System.Globalization;
32using System.Reflection;
32using System.IO; 33using System.IO;
33using Microsoft.CSharp; 34using Microsoft.CSharp;
34using Microsoft.JScript; 35using Microsoft.JScript;
35using Microsoft.VisualBasic; 36using Microsoft.VisualBasic;
37using log4net;
36using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.ScriptEngine.Interfaces; 39using OpenSim.Region.ScriptEngine.Interfaces;
38 40
@@ -40,8 +42,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
40{ 42{
41 public class Compiler : ICompiler 43 public class Compiler : ICompiler
42 { 44 {
43 // private static readonly log4net.ILog m_log 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
45 46
46 // * Uses "LSL2Converter" to convert LSL to C# if necessary. 47 // * Uses "LSL2Converter" to convert LSL to C# if necessary.
47 // * Compiles C#-code into an assembly 48 // * Compiles C#-code into an assembly
@@ -126,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
126 AllowedCompilers.Clear(); 127 AllowedCompilers.Clear();
127 128
128#if DEBUG 129#if DEBUG
129 m_scriptEngine.Log.Debug("[Compiler]: Allowed languages: " + allowComp); 130 m_log.Debug("[Compiler]: Allowed languages: " + allowComp);
130#endif 131#endif
131 132
132 133
@@ -135,18 +136,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
135 string strlan = strl.Trim(" \t".ToCharArray()).ToLower(); 136 string strlan = strl.Trim(" \t".ToCharArray()).ToLower();
136 if (!LanguageMapping.ContainsKey(strlan)) 137 if (!LanguageMapping.ContainsKey(strlan))
137 { 138 {
138 m_scriptEngine.Log.Error("[Compiler]: Config error. Compiler is unable to recognize language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); 139 m_log.Error("[Compiler]: Config error. Compiler is unable to recognize language type \"" + strlan + "\" specified in \"AllowedCompilers\".");
139 } 140 }
140 else 141 else
141 { 142 {
142#if DEBUG 143#if DEBUG
143 //m_scriptEngine.Log.Debug("[Compiler]: Config OK. Compiler recognized language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); 144 //m_log.Debug("[Compiler]: Config OK. Compiler recognized language type \"" + strlan + "\" specified in \"AllowedCompilers\".");
144#endif 145#endif
145 } 146 }
146 AllowedCompilers.Add(strlan, true); 147 AllowedCompilers.Add(strlan, true);
147 } 148 }
148 if (AllowedCompilers.Count == 0) 149 if (AllowedCompilers.Count == 0)
149 m_scriptEngine.Log.Error("[Compiler]: Config error. Compiler could not recognize any language in \"AllowedCompilers\". Scripts will not be executed!"); 150 m_log.Error("[Compiler]: Config error. Compiler could not recognize any language in \"AllowedCompilers\". Scripts will not be executed!");
150 151
151 // Default language 152 // Default language
152 string defaultCompileLanguage = m_scriptEngine.Config.GetString("DefaultCompileLanguage", "lsl").ToLower(); 153 string defaultCompileLanguage = m_scriptEngine.Config.GetString("DefaultCompileLanguage", "lsl").ToLower();
@@ -154,7 +155,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
154 // Is this language recognized at all? 155 // Is this language recognized at all?
155 if (!LanguageMapping.ContainsKey(defaultCompileLanguage)) 156 if (!LanguageMapping.ContainsKey(defaultCompileLanguage))
156 { 157 {
157 m_scriptEngine.Log.Error("[Compiler]: " + 158 m_log.Error("[Compiler]: " +
158 "Config error. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is not recognized as a valid language. Changing default to: \"lsl\"."); 159 "Config error. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is not recognized as a valid language. Changing default to: \"lsl\".");
159 defaultCompileLanguage = "lsl"; 160 defaultCompileLanguage = "lsl";
160 } 161 }
@@ -162,13 +163,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
162 // Is this language in allow-list? 163 // Is this language in allow-list?
163 if (!AllowedCompilers.ContainsKey(defaultCompileLanguage)) 164 if (!AllowedCompilers.ContainsKey(defaultCompileLanguage))
164 { 165 {
165 m_scriptEngine.Log.Error("[Compiler]: " + 166 m_log.Error("[Compiler]: " +
166 "Config error. Default language \"" + defaultCompileLanguage + "\"specified in \"DefaultCompileLanguage\" is not in list of \"AllowedCompilers\". Scripts may not be executed!"); 167 "Config error. Default language \"" + defaultCompileLanguage + "\"specified in \"DefaultCompileLanguage\" is not in list of \"AllowedCompilers\". Scripts may not be executed!");
167 } 168 }
168 else 169 else
169 { 170 {
170#if DEBUG 171#if DEBUG
171// m_scriptEngine.Log.Debug("[Compiler]: " + 172// m_log.Debug("[Compiler]: " +
172// "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language."); 173// "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language.");
173#endif 174#endif
174 // LANGUAGE IS IN ALLOW-LIST 175 // LANGUAGE IS IN ALLOW-LIST
@@ -194,7 +195,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
194 } 195 }
195 catch (Exception ex) 196 catch (Exception ex)
196 { 197 {
197 m_scriptEngine.Log.Error("[Compiler]: Exception trying to create ScriptEngine directory \"" + ScriptEnginesPath + "\": " + ex.ToString()); 198 m_log.Error("[Compiler]: Exception trying to create ScriptEngine directory \"" + ScriptEnginesPath + "\": " + ex.ToString());
198 } 199 }
199 } 200 }
200 201
@@ -208,7 +209,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
208 } 209 }
209 catch (Exception ex) 210 catch (Exception ex)
210 { 211 {
211 m_scriptEngine.Log.Error("[Compiler]: Exception trying to create ScriptEngine directory \"" + Path.Combine(ScriptEnginesPath, 212 m_log.Error("[Compiler]: Exception trying to create ScriptEngine directory \"" + Path.Combine(ScriptEnginesPath,
212 m_scriptEngine.World.RegionInfo.RegionID.ToString())+ "\": " + ex.ToString()); 213 m_scriptEngine.World.RegionInfo.RegionID.ToString())+ "\": " + ex.ToString());
213 } 214 }
214 } 215 }
@@ -216,7 +217,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
216 foreach (string file in Directory.GetFiles(Path.Combine(ScriptEnginesPath, 217 foreach (string file in Directory.GetFiles(Path.Combine(ScriptEnginesPath,
217 m_scriptEngine.World.RegionInfo.RegionID.ToString()))) 218 m_scriptEngine.World.RegionInfo.RegionID.ToString())))
218 { 219 {
219 //m_scriptEngine.Log.Error("[Compiler]: FILE FOUND: " + file); 220 //m_log.Error("[Compiler]: FILE FOUND: " + file);
220 221
221 if (file.ToLower().StartsWith(FilePrefix + "_compiled_") || 222 if (file.ToLower().StartsWith(FilePrefix + "_compiled_") ||
222 file.ToLower().StartsWith(FilePrefix + "_source_")) 223 file.ToLower().StartsWith(FilePrefix + "_source_"))
@@ -227,12 +228,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
227 } 228 }
228 catch (Exception ex) 229 catch (Exception ex)
229 { 230 {
230 m_scriptEngine.Log.Error("[Compiler]: Exception trying delete old script file \"" + file + "\": " + ex.ToString()); 231 m_log.Error("[Compiler]: Exception trying delete old script file \"" + file + "\": " + ex.ToString());
231 } 232 }
232
233 } 233 }
234 } 234 }
235
236 } 235 }
237 236
238 ////private ICodeCompiler icc = codeProvider.CreateCompiler(); 237 ////private ICodeCompiler icc = codeProvider.CreateCompiler();
@@ -293,9 +292,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
293 if (Script == String.Empty) 292 if (Script == String.Empty)
294 { 293 {
295 if (File.Exists(OutFile)) 294 if (File.Exists(OutFile))
296
297 { 295 {
298// m_scriptEngine.Log.DebugFormat("[Compiler] Returning existing assembly for {0}", asset); 296// m_log.DebugFormat("[Compiler] Returning existing assembly for {0}", asset);
299 return OutFile; 297 return OutFile;
300 } 298 }
301 299
@@ -345,7 +343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
345 // 343 //
346 if (File.Exists(OutFile) && File.Exists(OutFile+".text")) 344 if (File.Exists(OutFile) && File.Exists(OutFile+".text"))
347 { 345 {
348// m_scriptEngine.Log.DebugFormat("[Compiler] Returning existing assembly for {0}", asset); 346// m_log.DebugFormat("[Compiler] Returning existing assembly for {0}", asset);
349 return OutFile; 347 return OutFile;
350 } 348 }
351 349
@@ -465,9 +463,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
465 } 463 }
466 catch (Exception ex) //NOTLEGIT - Should be just FileIOException 464 catch (Exception ex) //NOTLEGIT - Should be just FileIOException
467 { 465 {
468 m_scriptEngine.Log.Error("[Compiler]: Exception while "+ 466 m_log.Error("[Compiler]: Exception while "+
469 "trying to write script source to file \"" + 467 "trying to write script source to file \"" +
470 srcFileName + "\": " + ex.ToString()); 468 srcFileName + "\": " + ex.ToString());
471 } 469 }
472 } 470 }
473 471
@@ -577,7 +575,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
577 errtext += "No compile error. But not able to locate compiled file."; 575 errtext += "No compile error. But not able to locate compiled file.";
578 throw new Exception(errtext); 576 throw new Exception(errtext);
579 } 577 }
580// m_scriptEngine.Log.DebugFormat("[Compiler] Compiled new assembly "+ 578// m_log.DebugFormat("[Compiler] Compiled new assembly "+
581// "for {0}", asset); 579// "for {0}", asset);
582 580
583 // Because windows likes to perform exclusive locks, we simply 581 // Because windows likes to perform exclusive locks, we simply
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 20e70d0..c1d6f8e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -265,7 +265,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
265 } 265 }
266 catch (Exception e) 266 catch (Exception e)
267 { 267 {
268 m_Engine.Log.ErrorFormat("[Script] Error loading assembly {0}\n"+e.ToString(), assembly); 268 m_log.ErrorFormat("[Script] Error loading assembly {0}\n"+e.ToString(), assembly);
269 } 269 }
270 270
271 try 271 try
@@ -275,14 +275,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
275 m_Script.InitApi(kv.Key, kv.Value); 275 m_Script.InitApi(kv.Key, kv.Value);
276 } 276 }
277 277
278// m_Engine.Log.Debug("[Script] Script instance created"); 278// m_log.Debug("[Script] Script instance created");
279 279
280 part.SetScriptEvents(m_ItemID, 280 part.SetScriptEvents(m_ItemID,
281 (int)m_Script.GetStateEventFlags(State)); 281 (int)m_Script.GetStateEventFlags(State));
282 } 282 }
283 catch (Exception e) 283 catch (Exception e)
284 { 284 {
285 m_Engine.Log.Error("[Script] Error loading script instance\n"+e.ToString()); 285 m_log.Error("[Script] Error loading script instance\n"+e.ToString());
286 return; 286 return;
287 } 287 }
288 288
@@ -317,7 +317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
317 m_LocalID, m_ItemID, m_ObjectID, 317 m_LocalID, m_ItemID, m_ObjectID,
318 PluginData); 318 PluginData);
319 319
320// m_Engine.Log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", m_PrimName, m_ScriptName); 320// m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", m_PrimName, m_ScriptName);
321 321
322 part.SetScriptEvents(m_ItemID, 322 part.SetScriptEvents(m_ItemID,
323 (int)m_Script.GetStateEventFlags(State)); 323 (int)m_Script.GetStateEventFlags(State));
@@ -344,12 +344,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
344 } 344 }
345 else 345 else
346 { 346 {
347 m_Engine.Log.Error("[Script] Unable to load script state: Memory limit exceeded"); 347 m_log.Error("[Script] Unable to load script state: Memory limit exceeded");
348 } 348 }
349 } 349 }
350 catch (Exception e) 350 catch (Exception e)
351 { 351 {
352 m_Engine.Log.ErrorFormat("[Script] Unable to load script state from xml: {0}\n"+e.ToString(), xml); 352 m_log.ErrorFormat("[Script] Unable to load script state from xml: {0}\n"+e.ToString(), xml);
353 } 353 }
354 } 354 }
355 else 355 else
@@ -359,7 +359,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
359 if (presence != null && (!postOnRez)) 359 if (presence != null && (!postOnRez))
360 presence.ControllingClient.SendAgentAlertMessage("Compile successful", false); 360 presence.ControllingClient.SendAgentAlertMessage("Compile successful", false);
361 361
362// m_Engine.Log.ErrorFormat("[Script] Unable to load script state, file not found"); 362// m_log.ErrorFormat("[Script] Unable to load script state, file not found");
363 } 363 }
364 } 364 }
365 365
@@ -378,7 +378,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
378 378
379 if (m_stateSource == StateSource.NewRez) 379 if (m_stateSource == StateSource.NewRez)
380 { 380 {
381// m_Engine.Log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script"); 381// m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script");
382 PostEvent(new EventParams("changed", 382 PostEvent(new EventParams("changed",
383 new Object[] {new LSL_Types.LSLInteger(256)}, new DetectParams[0])); 383 new Object[] {new LSL_Types.LSLInteger(256)}, new DetectParams[0]));
384 } 384 }
@@ -473,7 +473,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
473 if (m_CurrentResult == null) 473 if (m_CurrentResult == null)
474 m_CurrentResult = m_Engine.QueueEventHandler(this); 474 m_CurrentResult = m_Engine.QueueEventHandler(this);
475 else 475 else
476 m_Engine.Log.Error("[Script] Tried to start a script that was already queued"); 476 m_log.Error("[Script] Tried to start a script that was already queued");
477 } 477 }
478 } 478 }
479 } 479 }
@@ -545,7 +545,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
545 545
546 public void PostEvent(EventParams data) 546 public void PostEvent(EventParams data)
547 { 547 {
548// m_Engine.Log.DebugFormat("[Script] Posted event {2} in state {3} to {0}.{1}", 548// m_log.DebugFormat("[Script] Posted event {2} in state {3} to {0}.{1}",
549// m_PrimName, m_ScriptName, data.EventName, m_State); 549// m_PrimName, m_ScriptName, data.EventName, m_State);
550 550
551 if (!Running) 551 if (!Running)
@@ -659,7 +659,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
659 659
660 if (data.EventName == "state") // Hardcoded state change 660 if (data.EventName == "state") // Hardcoded state change
661 { 661 {
662 // m_Engine.Log.DebugFormat("[Script] Script {0}.{1} state set to {2}", 662 // m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
663 // m_PrimName, m_ScriptName, data.Params[0].ToString()); 663 // m_PrimName, m_ScriptName, data.Params[0].ToString());
664 m_State=data.Params[0].ToString(); 664 m_State=data.Params[0].ToString();
665 AsyncCommandManager.RemoveScript(m_Engine, 665 AsyncCommandManager.RemoveScript(m_Engine,
@@ -680,7 +680,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
680 { 680 {
681 SceneObjectPart part = m_Engine.World.GetSceneObjectPart( 681 SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
682 m_LocalID); 682 m_LocalID);
683 // m_Engine.Log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}", 683 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
684 // m_PrimName, m_ScriptName, data.EventName, m_State); 684 // m_PrimName, m_ScriptName, data.EventName, m_State);
685 685
686 try 686 try
@@ -726,12 +726,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
726 } 726 }
727 catch (Exception e2) // LEGIT: User Scripting 727 catch (Exception e2) // LEGIT: User Scripting
728 { 728 {
729 m_Engine.Log.Error("[Script]: "+ 729 m_log.Error("[Script]: "+
730 "Error displaying error in-world: " + 730 "Error displaying error in-world: " +
731 e2.ToString()); 731 e2.ToString());
732 m_Engine.Log.Error("[Script]: " + 732 m_log.Error("[Script]: " +
733 "Errormessage: Error compiling script:\r\n" + 733 "Errormessage: Error compiling script:\r\n" +
734 e.ToString()); 734 e.ToString());
735 } 735 }
736 } 736 }
737 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException)) 737 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 2632948..b1b82e5 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
33using OpenSim.Region.CoreModules.Avatar.Currency.SampleMoney; 34using OpenSim.Region.CoreModules.Avatar.Currency.SampleMoney;
@@ -35,6 +36,7 @@ using OpenSim.Region.Framework.Scenes;
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.ScriptEngine.Shared; 37using OpenSim.Region.ScriptEngine.Shared;
37using OpenSim.Region.ScriptEngine.Interfaces; 38using OpenSim.Region.ScriptEngine.Interfaces;
39using log4net;
38 40
39namespace OpenSim.Region.ScriptEngine.XEngine 41namespace OpenSim.Region.ScriptEngine.XEngine
40{ 42{
@@ -43,13 +45,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
43 /// </summary> 45 /// </summary>
44 public class EventManager 46 public class EventManager
45 { 47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
46 private XEngine myScriptEngine; 50 private XEngine myScriptEngine;
47 51
48 public EventManager(XEngine _ScriptEngine) 52 public EventManager(XEngine _ScriptEngine)
49 { 53 {
50 myScriptEngine = _ScriptEngine; 54 myScriptEngine = _ScriptEngine;
51 55
52 myScriptEngine.Log.Info("[XEngine] Hooking up to server events"); 56 m_log.Info("[XEngine] Hooking up to server events");
53 myScriptEngine.World.EventManager.OnObjectGrab += touch_start; 57 myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
54 myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; 58 myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end;
55 myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; 59 myScriptEngine.World.EventManager.OnScriptChangedEvent += changed;
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 7a36bc2..75d0bec 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -125,11 +125,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
125 get { return m_Scene; } 125 get { return m_Scene; }
126 } 126 }
127 127
128 public ILog Log
129 {
130 get { return m_log; }
131 }
132
133 public static List<XEngine> ScriptEngines 128 public static List<XEngine> ScriptEngines
134 { 129 {
135 get { return m_ScriptEngines; } 130 get { return m_ScriptEngines; }
@@ -483,7 +478,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
483 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); 478 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
484 if (part == null) 479 if (part == null)
485 { 480 {
486 Log.Error("[Script] SceneObjectPart unavailable. Script NOT started."); 481 m_log.Error("[Script] SceneObjectPart unavailable. Script NOT started.");
487 m_ScriptErrorMessage += "SceneObjectPart unavailable. Script NOT started.\n"; 482 m_ScriptErrorMessage += "SceneObjectPart unavailable. Script NOT started.\n";
488 m_ScriptFailCount++; 483 m_ScriptFailCount++;
489 return false; 484 return false;
diff --git a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs b/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs
index d883e2f..74d1745 100644
--- a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs
+++ b/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs
@@ -96,7 +96,6 @@ namespace OpenSim.ScriptEngine.Engines.DotNetEngine
96 RegionInfo.Executors = new Dictionary<string, IScriptExecutor>(); 96 RegionInfo.Executors = new Dictionary<string, IScriptExecutor>();
97 RegionInfo.CommandProviders = new Dictionary<string, IScriptCommandProvider>(); 97 RegionInfo.CommandProviders = new Dictionary<string, IScriptCommandProvider>();
98 RegionInfo.EventProviders = new Dictionary<string, IScriptEventProvider>(); 98 RegionInfo.EventProviders = new Dictionary<string, IScriptEventProvider>();
99 RegionInfo.Logger = LogManager.GetLogger("SECS.DotNetEngine.RegionInfo");
100 } 99 }
101 100
102 public void Initialise(Scene scene, IConfigSource source) 101 public void Initialise(Scene scene, IConfigSource source)
diff --git a/OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs b/OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs
index 693f38c..64b33d4 100644
--- a/OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs
+++ b/OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs
@@ -48,7 +48,6 @@ namespace OpenSim.ScriptEngine.Shared
48 public Dictionary<string, IScriptCompiler> Compilers; 48 public Dictionary<string, IScriptCompiler> Compilers;
49 public Dictionary<string, IScriptScheduler> Schedulers; 49 public Dictionary<string, IScriptScheduler> Schedulers;
50 public Dictionary<string, IScriptCommandProvider> CommandProviders; 50 public Dictionary<string, IScriptCommandProvider> CommandProviders;
51 public ILog Logger;
52 51
53 public void Executors_Execute(EventParams p) 52 public void Executors_Execute(EventParams p)
54 { 53 {
diff --git a/OpenSim/ScriptEngine/Shared/ScriptStructure.cs b/OpenSim/ScriptEngine/Shared/ScriptStructure.cs
index 785040c..1095a8b 100644
--- a/OpenSim/ScriptEngine/Shared/ScriptStructure.cs
+++ b/OpenSim/ScriptEngine/Shared/ScriptStructure.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Text; 31using System.Text;
32using log4net;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Region.ScriptEngine.Interfaces; 34using OpenSim.Region.ScriptEngine.Interfaces;
34using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 35using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
@@ -38,6 +39,8 @@ namespace OpenSim.ScriptEngine.Shared
38{ 39{
39 public struct ScriptStructure 40 public struct ScriptStructure
40 { 41 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43
41 public RegionInfoStructure RegionInfo; 44 public RegionInfoStructure RegionInfo;
42 public ScriptMetaData ScriptMetaData; 45 public ScriptMetaData ScriptMetaData;
43 46
@@ -91,8 +94,7 @@ namespace OpenSim.ScriptEngine.Shared
91 if (!InternalFunctions.ContainsKey(FunctionName)) 94 if (!InternalFunctions.ContainsKey(FunctionName))
92 { 95 {
93 // TODO: Send message in-world 96 // TODO: Send message in-world
94 //RegionInfo.Scene. 97 m_log.ErrorFormat("[{0}] Script function \"{1}\" was not found.", Name, FunctionName);
95 RegionInfo.Logger.ErrorFormat("[{0}] Script function \"{1}\" was not found.", Name, FunctionName);
96 return; 98 return;
97 } 99 }
98 100
@@ -103,7 +105,7 @@ namespace OpenSim.ScriptEngine.Shared
103 } 105 }
104 catch (Exception e) 106 catch (Exception e)
105 { 107 {
106 RegionInfo.Logger.ErrorFormat("[{0}] Execute \"{1}\" failed: {2}", Name, FunctionName, e.ToString()); 108 m_log.ErrorFormat("[{0}] Execute \"{1}\" failed: {2}", Name, FunctionName, e.ToString());
107 } 109 }
108 } 110 }
109 } 111 }
@@ -126,8 +128,8 @@ namespace OpenSim.ScriptEngine.Shared
126 if (!InternalFunctions.ContainsKey(mi.Name)) 128 if (!InternalFunctions.ContainsKey(mi.Name))
127 InternalFunctions.Add(mi.Name, Delegate.CreateDelegate(scriptObjectType, ScriptObject, mi)); 129 InternalFunctions.Add(mi.Name, Delegate.CreateDelegate(scriptObjectType, ScriptObject, mi));
128 else 130 else
129 RegionInfo.Logger.ErrorFormat("[{0}] Error: Script function \"{1}\" is already added. We do not support overloading.", 131 m_log.ErrorFormat("[{0}] Error: Script function \"{1}\" is already added. We do not support overloading.",
130 Name, mi.Name); 132 Name, mi.Name);
131 } 133 }
132 } 134 }
133 } 135 }