aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common
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/Region/ScriptEngine/Common
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 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs18
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/Common.cs19
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs23
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs32
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs34
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs4
11 files changed, 72 insertions, 88 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs
index 8511b56..3a38497 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs
@@ -41,7 +41,6 @@ namespace OpenSim.Region.ScriptEngine.Common
41{ 41{
42 public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript 42 public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript
43 { 43 {
44
45 // 44 //
46 // Included as base for any LSL-script that is compiled. 45 // Included as base for any LSL-script that is compiled.
47 // Any function added here will be accessible to the LSL script. But it must also be added to "LSL_BuiltIn_Commands_Interface" in "OpenSim.Region.ScriptEngine.Common" class. 46 // Any function added here will be accessible to the LSL script. But it must also be added to "LSL_BuiltIn_Commands_Interface" in "OpenSim.Region.ScriptEngine.Common" class.
@@ -49,6 +48,8 @@ namespace OpenSim.Region.ScriptEngine.Common
49 // Security note: This script will be running inside an restricted AppDomain. Currently AppDomain is not very restricted. 48 // Security note: This script will be running inside an restricted AppDomain. Currently AppDomain is not very restricted.
50 // 49 //
51 50
51 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
52
52 // Object never expires 53 // Object never expires
53 public override Object InitializeLifetimeService() 54 public override Object InitializeLifetimeService()
54 { 55 {
@@ -112,7 +113,7 @@ namespace OpenSim.Region.ScriptEngine.Common
112 { 113 {
113 m_LSL_Functions = LSL_Functions; 114 m_LSL_Functions = LSL_Functions;
114 115
115 //MainLog.Instance.Notice(ScriptEngineName, "LSL_BaseClass.Start() called."); 116 //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called.");
116 117
117 // Get this AppDomain's settings and display some of them. 118 // Get this AppDomain's settings and display some of them.
118 AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; 119 AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation;
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 242bd27..66475c3 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -43,12 +43,13 @@ using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
43 43
44namespace OpenSim.Region.ScriptEngine.Common 44namespace OpenSim.Region.ScriptEngine.Common
45{ 45{
46
47 /// <summary> 46 /// <summary>
48 /// Contains all LSL ll-functions. This class will be in Default AppDomain. 47 /// Contains all LSL ll-functions. This class will be in Default AppDomain.
49 /// </summary> 48 /// </summary>
50 public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface 49 public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface
51 { 50 {
51 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
52
52 private ASCIIEncoding enc = new ASCIIEncoding(); 53 private ASCIIEncoding enc = new ASCIIEncoding();
53 private ScriptEngineBase.ScriptEngine m_ScriptEngine; 54 private ScriptEngineBase.ScriptEngine m_ScriptEngine;
54 private SceneObjectPart m_host; 55 private SceneObjectPart m_host;
@@ -63,7 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Common
63 m_localID = localID; 64 m_localID = localID;
64 m_itemID = itemID; 65 m_itemID = itemID;
65 66
66 //MainLog.Instance.Notice(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); 67 //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]");
67 } 68 }
68 69
69 private DateTime m_timer = DateTime.Now; 70 private DateTime m_timer = DateTime.Now;
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs
index 2ed0529..0fb8d75 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs
@@ -26,7 +26,6 @@
26* 26*
27*/ 27*/
28 28
29
30using System; 29using System;
31using System.Collections; 30using System.Collections;
32using System.Collections.Generic; 31using System.Collections.Generic;
@@ -37,7 +36,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
37{ 36{
38 public class AppDomainManager : iScriptEngineFunctionModule 37 public class AppDomainManager : iScriptEngineFunctionModule
39 { 38 {
40
41 // 39 //
42 // This class does AppDomain handling and loading/unloading of scripts in it. 40 // This class does AppDomain handling and loading/unloading of scripts in it.
43 // It is instanced in "ScriptEngine" and controlled from "ScriptManager" 41 // It is instanced in "ScriptEngine" and controlled from "ScriptManager"
@@ -48,7 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
48 // 4. Unload AppDomain completely when all scripts in it has stopped 46 // 4. Unload AppDomain completely when all scripts in it has stopped
49 // 47 //
50 48
51
52 private int maxScriptsPerAppDomain = 1; 49 private int maxScriptsPerAppDomain = 1;
53 50
54 /// <summary> 51 /// <summary>
@@ -149,8 +146,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
149 ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; 146 ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
150 147
151 AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads); 148 AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads);
152 m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "AppDomain Loading: " + 149 m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: AppDomain Loading: " +
153 AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString()); 150 AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString());
154 AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll")); 151 AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll"));
155 152
156 // Return the new AppDomain 153 // Return the new AppDomain
@@ -183,7 +180,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
183 // Unload 180 // Unload
184 AppDomain.Unload(ads.CurrentAppDomain); 181 AppDomain.Unload(ads.CurrentAppDomain);
185#if DEBUG 182#if DEBUG
186 m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory"); 183 m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory");
187#endif 184#endif
188 } 185 }
189 } 186 }
@@ -191,14 +188,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
191 } // lock 188 } // lock
192 } 189 }
193 190
194
195 public IScript LoadScript(string FileName) 191 public IScript LoadScript(string FileName)
196 { 192 {
197 // Find next available AppDomain to put it in 193 // Find next available AppDomain to put it in
198 AppDomainStructure FreeAppDomain = GetFreeAppDomain(); 194 AppDomainStructure FreeAppDomain = GetFreeAppDomain();
199 195
200#if DEBUG 196#if DEBUG
201 m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "Loading into AppDomain: " + FileName); 197 m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: Loading into AppDomain: " + FileName);
202#endif 198#endif
203 IScript mbrt = 199 IScript mbrt =
204 (IScript) 200 (IScript)
@@ -220,7 +216,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
220 lock (freeLock) 216 lock (freeLock)
221 { 217 {
222#if DEBUG 218#if DEBUG
223 m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "Stopping script in AppDomain"); 219 m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: Stopping script in AppDomain");
224#endif 220#endif
225 // Check if it is current AppDomain 221 // Check if it is current AppDomain
226 if (currentAD.CurrentAppDomain == ad) 222 if (currentAD.CurrentAppDomain == ad)
@@ -244,6 +240,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
244 240
245 UnloadAppDomains(); // Outsite lock, has its own GetLock 241 UnloadAppDomains(); // Outsite lock, has its own GetLock
246 } 242 }
243
247 /// <summary> 244 /// <summary>
248 /// If set to true then threads and stuff should try to make a graceful exit 245 /// If set to true then threads and stuff should try to make a graceful exit
249 /// </summary> 246 /// </summary>
@@ -253,6 +250,5 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
253 set { _PleaseShutdown = value; } 250 set { _PleaseShutdown = value; }
254 } 251 }
255 private bool _PleaseShutdown = false; 252 private bool _PleaseShutdown = false;
256
257 } 253 }
258} \ No newline at end of file 254}
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/Common.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/Common.cs
index fe6dfcd..e99f0a7 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/Common.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/Common.cs
@@ -26,7 +26,6 @@
26* 26*
27*/ 27*/
28 28
29
30namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase 29namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
31{ 30{
32 public static class Common 31 public static class Common
@@ -36,23 +35,23 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
36 35
37 // This class just contains some static log stuff used for debugging. 36 // This class just contains some static log stuff used for debugging.
38 37
39 //public delegate void SendToDebugEventDelegate(string Message); 38 //public delegate void SendToDebugEventDelegate(string message);
40 //public delegate void SendToLogEventDelegate(string Message); 39 //public delegate void SendToLogEventDelegate(string message);
41 //static public event SendToDebugEventDelegate SendToDebugEvent; 40 //static public event SendToDebugEventDelegate SendToDebugEvent;
42 //static public event SendToLogEventDelegate SendToLogEvent; 41 //static public event SendToLogEventDelegate SendToLogEvent;
43 42
44 public static void SendToDebug(string Message) 43 public static void SendToDebug(string message)
45 { 44 {
46 //if (Debug == true) 45 //if (Debug == true)
47 mySE.Log.Verbose(mySE.ScriptEngineName, "Debug: " + Message); 46 mySE.Log.Info("[" + mySE.ScriptEngineName + "]: Debug: " + message);
48 //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); 47 //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + message);
49 } 48 }
50 49
51 public static void SendToLog(string Message) 50 public static void SendToLog(string message)
52 { 51 {
53 //if (Debug == true) 52 //if (Debug == true)
54 mySE.Log.Verbose(mySE.ScriptEngineName, "LOG: " + Message); 53 mySE.Log.Info("[" + mySE.ScriptEngineName + "]: LOG: " + message);
55 //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); 54 //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + message);
56 } 55 }
57 } 56 }
58} \ No newline at end of file 57}
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
index 678c3d0..1de010a 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
@@ -39,7 +39,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
39 [Serializable] 39 [Serializable]
40 public class EventManager : OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents, iScriptEngineFunctionModule 40 public class EventManager : OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents, iScriptEngineFunctionModule
41 { 41 {
42
43 // 42 //
44 // Class is instanced in "ScriptEngine" and Uses "EventQueueManager" that is also instanced in "ScriptEngine". 43 // Class is instanced in "ScriptEngine" and Uses "EventQueueManager" that is also instanced in "ScriptEngine".
45 // This class needs a bit of explaining: 44 // This class needs a bit of explaining:
@@ -65,7 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
65 // We may not want to do it because someone is controlling us and will deliver events to us 64 // We may not want to do it because someone is controlling us and will deliver events to us
66 if (performHookUp) 65 if (performHookUp)
67 { 66 {
68 myScriptEngine.Log.Verbose(myScriptEngine.ScriptEngineName, "Hooking up to server events"); 67 myScriptEngine.Log.Info("[" + myScriptEngine.ScriptEngineName + "]: Hooking up to server events");
69 myScriptEngine.World.EventManager.OnObjectGrab += touch_start; 68 myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
70 myScriptEngine.World.EventManager.OnRezScript += OnRezScript; 69 myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
71 myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; 70 myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
@@ -78,7 +77,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
78 { 77 {
79 } 78 }
80 79
81
82 public void changed(uint localID, uint change) 80 public void changed(uint localID, uint change)
83 { 81 {
84 // Add to queue for all scripts in localID, Object pass change. 82 // Add to queue for all scripts in localID, Object pass change.
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
index e1b1b6c..5e06fcd 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
@@ -44,7 +44,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
44 [Serializable] 44 [Serializable]
45 public class EventQueueManager : iScriptEngineFunctionModule 45 public class EventQueueManager : iScriptEngineFunctionModule
46 { 46 {
47
48 // 47 //
49 // Class is instanced in "ScriptEngine" and used by "EventManager" also instanced in "ScriptEngine". 48 // Class is instanced in "ScriptEngine" and used by "EventManager" also instanced in "ScriptEngine".
50 // 49 //
@@ -256,16 +255,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
256 255
257 #endregion 256 #endregion
258 257
259
260 #region " Start / stop script execution threads (ThreadClasses) " 258 #region " Start / stop script execution threads (ThreadClasses) "
261 private void StartNewThreadClass() 259 private void StartNewThreadClass()
262 { 260 {
263 EventQueueThreadClass eqtc = new EventQueueThreadClass(this); 261 EventQueueThreadClass eqtc = new EventQueueThreadClass(this);
264 eventQueueThreads.Add(eqtc); 262 eventQueueThreads.Add(eqtc);
265 staticGlobalEventQueueThreads.Add(eqtc); 263 staticGlobalEventQueueThreads.Add(eqtc);
266 m_ScriptEngine.Log.Debug(m_ScriptEngine.ScriptEngineName, "Started new script execution thread. Current thread count: " + eventQueueThreads.Count); 264 m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Started new script execution thread. Current thread count: " + eventQueueThreads.Count);
267
268 } 265 }
266
269 private void AbortThreadClass(EventQueueThreadClass threadClass) 267 private void AbortThreadClass(EventQueueThreadClass threadClass)
270 { 268 {
271 if (eventQueueThreads.Contains(threadClass)) 269 if (eventQueueThreads.Contains(threadClass))
@@ -279,10 +277,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
279 } 277 }
280 catch (Exception ex) 278 catch (Exception ex)
281 { 279 {
282 m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName + ":EventQueueManager", "If you see this, could you please report it to Tedd:"); 280 m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: If you see this, could you please report it to Tedd:");
283 m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName + ":EventQueueManager", "Script thread execution timeout kill ended in exception: " + ex.ToString()); 281 m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: Script thread execution timeout kill ended in exception: " + ex.ToString());
284 } 282 }
285 m_ScriptEngine.Log.Debug(m_ScriptEngine.ScriptEngineName, "Killed script execution thread. Remaining thread count: " + eventQueueThreads.Count); 283 m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Killed script execution thread. Remaining thread count: " + eventQueueThreads.Count);
286 } 284 }
287 #endregion 285 #endregion
288 286
@@ -334,8 +332,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
334 public void AddToObjectQueue(uint localID, string FunctionName, Queue_llDetectParams_Struct qParams, params object[] param) 332 public void AddToObjectQueue(uint localID, string FunctionName, Queue_llDetectParams_Struct qParams, params object[] param)
335 { 333 {
336 // Determine all scripts in Object and add to their queue 334 // Determine all scripts in Object and add to their queue
337 //myScriptEngine.m_logger.Verbose(ScriptEngineName, "EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName); 335 //myScriptEngine.log.Info("[" + ScriptEngineName + "]: EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName);
338
339 336
340 // Do we have any scripts in this object at all? If not, return 337 // Do we have any scripts in this object at all? If not, return
341 if (m_ScriptEngine.m_ScriptManager.Scripts.ContainsKey(localID) == false) 338 if (m_ScriptEngine.m_ScriptManager.Scripts.ContainsKey(localID) == false)
@@ -368,8 +365,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
368 { 365 {
369 if (eventQueue.Count >= EventExecutionMaxQueueSize) 366 if (eventQueue.Count >= EventExecutionMaxQueueSize)
370 { 367 {
371 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."); 368 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.");
372 m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName, "Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); 369 m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
373 return; 370 return;
374 } 371 }
375 372
@@ -456,6 +453,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
456 } 453 }
457 } 454 }
458 #endregion 455 #endregion
456
459 /// <summary> 457 /// <summary>
460 /// If set to true then threads and stuff should try to make a graceful exit 458 /// If set to true then threads and stuff should try to make a graceful exit
461 /// </summary> 459 /// </summary>
@@ -465,6 +463,5 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
465 set { _PleaseShutdown = value; } 463 set { _PleaseShutdown = value; }
466 } 464 }
467 private bool _PleaseShutdown = false; 465 private bool _PleaseShutdown = false;
468
469 } 466 }
470} \ No newline at end of file 467}
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs
index ee38306..afa1839 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs
@@ -96,7 +96,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
96 break; 96 break;
97 default: 97 default:
98 MyThreadPriority = ThreadPriority.BelowNormal; // Default 98 MyThreadPriority = ThreadPriority.BelowNormal; // Default
99 eventQueueManager.m_ScriptEngine.Log.Error("ScriptEngineBase", "Unknown priority type \"" + pri + "\" in config file. Defaulting to \"BelowNormal\"."); 99 eventQueueManager.m_ScriptEngine.Log.Error("[ScriptEngineBase]: Unknown priority type \"" + pri + "\" in config file. Defaulting to \"BelowNormal\".");
100 break; 100 break;
101 } 101 }
102 102
@@ -137,7 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
137 } 137 }
138 catch (Exception) 138 catch (Exception)
139 { 139 {
140 //myScriptEngine.Log.Verbose(ScriptEngineName, "EventQueueManager Exception killing worker thread: " + e.ToString()); 140 //myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Exception killing worker thread: " + e.ToString());
141 } 141 }
142 } 142 }
143 } 143 }
@@ -147,7 +147,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
147 /// </summary> 147 /// </summary>
148 private void EventQueueThreadLoop() 148 private void EventQueueThreadLoop()
149 { 149 {
150 //myScriptEngine.m_logger.Verbose(ScriptEngineName, "EventQueueManager Worker thread spawned"); 150 //myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Worker thread spawned");
151 try 151 try
152 { 152 {
153 while (true) 153 while (true)
@@ -196,7 +196,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
196 else 196 else
197 { 197 {
198 // Something in queue, process 198 // Something in queue, process
199 //myScriptEngine.m_logger.Verbose(ScriptEngineName, "Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName); 199 //myScriptEngine.Log.Info("[" + ScriptEngineName + "]: Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName);
200 200
201 // OBJECT BASED LOCK - TWO THREADS WORKING ON SAME OBJECT IS NOT GOOD 201 // OBJECT BASED LOCK - TWO THREADS WORKING ON SAME OBJECT IS NOT GOOD
202 lock (eventQueueManager.queueLock) 202 lock (eventQueueManager.queueLock)
@@ -228,12 +228,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
228 try 228 try
229 { 229 {
230#if DEBUG 230#if DEBUG
231 eventQueueManager.m_ScriptEngine.Log.Debug(ScriptEngineName, 231 eventQueueManager.m_ScriptEngine.Log.Debug("[" + ScriptEngineName + "]: " +
232 "Executing event:\r\n" 232 "Executing event:\r\n"
233 + "QIS.localID: " + QIS.localID 233 + "QIS.localID: " + QIS.localID
234 + ", QIS.itemID: " + QIS.itemID 234 + ", QIS.itemID: " + QIS.itemID
235 + ", QIS.functionName: " + 235 + ", QIS.functionName: " +
236 QIS.functionName); 236 QIS.functionName);
237#endif 237#endif
238 LastExecutionStarted = DateTime.Now.Ticks; 238 LastExecutionStarted = DateTime.Now.Ticks;
239 KillCurrentScript = false; 239 KillCurrentScript = false;
@@ -284,9 +284,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
284 //else 284 //else
285 //{ 285 //{
286 // T oconsole 286 // T oconsole
287 eventQueueManager.m_ScriptEngine.Log.Error(ScriptEngineName, 287 eventQueueManager.m_ScriptEngine.Log.Error("[" + ScriptEngineName + "]: " +
288 "Unable to send text in-world:\r\n" + 288 "Unable to send text in-world:\r\n" +
289 text); 289 text);
290 } 290 }
291 finally 291 finally
292 { 292 {
@@ -309,17 +309,17 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
309 } 309 }
310 catch (ThreadAbortException tae) 310 catch (ThreadAbortException tae)
311 { 311 {
312 eventQueueManager.m_ScriptEngine.Log.Notice(ScriptEngineName, "ThreadAbortException while executing function."); 312 eventQueueManager.m_ScriptEngine.Log.Info("[" + ScriptEngineName + "]: ThreadAbortException while executing function.");
313 } 313 }
314 catch (Exception e) 314 catch (Exception e)
315 { 315 {
316 eventQueueManager.m_ScriptEngine.Log.Error(ScriptEngineName, "Exception in EventQueueThreadLoop: " + e.ToString()); 316 eventQueueManager.m_ScriptEngine.Log.Error("[" + ScriptEngineName + "]: Exception in EventQueueThreadLoop: " + e.ToString());
317 } 317 }
318 } // while 318 } // while
319 } // try 319 } // try
320 catch (ThreadAbortException) 320 catch (ThreadAbortException)
321 { 321 {
322 //myScriptEngine.Log.Verbose(ScriptEngineName, "EventQueueManager Worker thread killed: " + tae.Message); 322 //myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Worker thread killed: " + tae.Message);
323 } 323 }
324 } 324 }
325 325
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
index 4a119f0..ab4ea04 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
87 private void StopMaintenanceThread() 87 private void StopMaintenanceThread()
88 { 88 {
89#if DEBUG 89#if DEBUG
90 m_ScriptEngine.Log.Debug(m_ScriptEngine.ScriptEngineName, "StopMaintenanceThread() called"); 90 m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: StopMaintenanceThread() called");
91#endif 91#endif
92 PleaseShutdown = true; 92 PleaseShutdown = true;
93 Thread.Sleep(100); 93 Thread.Sleep(100);
@@ -103,7 +103,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
103 } 103 }
104 catch (Exception ex) 104 catch (Exception ex)
105 { 105 {
106 m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName, "Exception stopping maintenence thread: " + ex.ToString()); 106 m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Exception stopping maintenence thread: " + ex.ToString());
107 } 107 }
108 } 108 }
109 109
@@ -113,8 +113,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
113 public void MaintenanceLoop() 113 public void MaintenanceLoop()
114 { 114 {
115 if (m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens < MaintenanceLoopms) 115 if (m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens < MaintenanceLoopms)
116 m_ScriptEngine.Log.Warn(m_ScriptEngine.ScriptEngineName, 116 m_ScriptEngine.Log.Warn("[" + m_ScriptEngine.ScriptEngineName + "]: " +
117 "Configuration error: MaxEventExecutionTimeMs is less than MaintenanceLoopms. The Maintenance Loop will only check scripts once per run."); 117 "Configuration error: MaxEventExecutionTimeMs is less than MaintenanceLoopms. The Maintenance Loop will only check scripts once per run.");
118 118
119 long Last_maxFunctionExecutionTimens = 0; // DateTime.Now.Ticks; 119 long Last_maxFunctionExecutionTimens = 0; // DateTime.Now.Ticks;
120 long Last_ReReadConfigFilens = DateTime.Now.Ticks; 120 long Last_ReReadConfigFilens = DateTime.Now.Ticks;
@@ -170,7 +170,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
170 } 170 }
171 catch (Exception ex) 171 catch (Exception ex)
172 { 172 {
173 m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName, "Exception in MaintenanceLoopThread. Thread will recover after 5 sec throttle. Exception: " + ex.ToString()); 173 m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Exception in MaintenanceLoopThread. Thread will recover after 5 sec throttle. Exception: " + ex.ToString());
174 Thread.Sleep(5000); 174 Thread.Sleep(5000);
175 } 175 }
176 } 176 }
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
index f09e631..78d9f7d 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
@@ -26,7 +26,6 @@
26* 26*
27*/ 27*/
28 28
29
30using System; 29using System;
31using System.IO; 30using System.IO;
32using Nini.Config; 31using Nini.Config;
@@ -45,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
45 [Serializable] 44 [Serializable]
46 public abstract class ScriptEngine : IRegionModule, OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule 45 public abstract class ScriptEngine : IRegionModule, OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule
47 { 46 {
47 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
48
48 public Scene World; 49 public Scene World;
49 public EventManager m_EventManager; // Handles and queues incoming events from OpenSim 50 public EventManager m_EventManager; // Handles and queues incoming events from OpenSim
50 public EventQueueManager m_EventQueueManager; // Executes events, handles script threads 51 public EventQueueManager m_EventQueueManager; // Executes events, handles script threads
@@ -73,7 +74,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
73 74
74 public abstract ScriptManager _GetScriptManager(); 75 public abstract ScriptManager _GetScriptManager();
75 76
76 private LogBase m_log; 77 public log4net.ILog Log
78 {
79 get { return m_log; }
80 }
77 81
78 public ScriptEngine() 82 public ScriptEngine()
79 { 83 {
@@ -81,25 +85,18 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
81 Common.mySE = this; 85 Common.mySE = this;
82 } 86 }
83 87
84 public LogBase Log 88 public void InitializeEngine(Scene Sceneworld, IConfigSource config, bool HookUpToServer, ScriptManager newScriptManager)
85 {
86 get { return m_log; }
87 }
88
89 public void InitializeEngine(Scene Sceneworld, IConfigSource config, LogBase logger, bool HookUpToServer, ScriptManager newScriptManager)
90 { 89 {
91 World = Sceneworld; 90 World = Sceneworld;
92 m_log = logger;
93 ConfigSource = config; 91 ConfigSource = config;
94 Log.Verbose(ScriptEngineName, "ScriptEngine initializing"); 92 m_log.Info("[" + ScriptEngineName + "]: ScriptEngine initializing");
95 93
96 // Make sure we have config 94 // Make sure we have config
97 if (ConfigSource.Configs[ScriptEngineName] == null) 95 if (ConfigSource.Configs[ScriptEngineName] == null)
98 ConfigSource.AddConfig(ScriptEngineName); 96 ConfigSource.AddConfig(ScriptEngineName);
99 ScriptConfigSource = ConfigSource.Configs[ScriptEngineName]; 97 ScriptConfigSource = ConfigSource.Configs[ScriptEngineName];
100 98
101 99 //m_log.Info("[" + ScriptEngineName + "]: InitializeEngine");
102 //m_logger.Status(ScriptEngineName, "InitializeEngine");
103 100
104 // Create all objects we'll be using 101 // Create all objects we'll be using
105 m_EventQueueManager = new EventQueueManager(this); 102 m_EventQueueManager = new EventQueueManager(this);
@@ -111,11 +108,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
111 m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(this); 108 m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(this);
112 m_MaintenanceThread = new MaintenanceThread(this); 109 m_MaintenanceThread = new MaintenanceThread(this);
113 110
114 Log.Verbose(ScriptEngineName, "Reading configuration from config section \"" + ScriptEngineName + "\""); 111 m_log.Info("[" + ScriptEngineName + "]: Reading configuration from config section \"" + ScriptEngineName + "\"");
115 ReadConfig(); 112 ReadConfig();
116 113
117
118
119 // Should we iterate the region for scripts that needs starting? 114 // Should we iterate the region for scripts that needs starting?
120 // Or can we assume we are loaded before anything else so we can use proper events? 115 // Or can we assume we are loaded before anything else so we can use proper events?
121 } 116 }
@@ -129,10 +124,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
129 { 124 {
130 return this.m_EventManager; 125 return this.m_EventManager;
131 } 126 }
127
132 public void ReadConfig() 128 public void ReadConfig()
133 { 129 {
134//#if DEBUG 130//#if DEBUG
135// Log.Debug(ScriptEngineName, "Refreshing configuration for all modules"); 131// m_log.Debug("[" + ScriptEngineName + "]: Refreshing configuration for all modules");
136//#endif 132//#endif
137 RefreshConfigFileSeconds = ScriptConfigSource.GetInt("RefreshConfig", 30); 133 RefreshConfigFileSeconds = ScriptConfigSource.GetInt("RefreshConfig", 30);
138 134
@@ -153,10 +149,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
153 if (m_AppDomainManager != null) m_AppDomainManager.ReadConfig(); 149 if (m_AppDomainManager != null) m_AppDomainManager.ReadConfig();
154 if (m_ASYNCLSLCommandManager != null) m_ASYNCLSLCommandManager.ReadConfig(); 150 if (m_ASYNCLSLCommandManager != null) m_ASYNCLSLCommandManager.ReadConfig();
155 if (m_MaintenanceThread != null) m_MaintenanceThread.ReadConfig(); 151 if (m_MaintenanceThread != null) m_MaintenanceThread.ReadConfig();
156
157 } 152 }
158 153
159
160 #region IRegionModule 154 #region IRegionModule
161 155
162 public abstract void Initialise(Scene scene, IConfigSource config); 156 public abstract void Initialise(Scene scene, IConfigSource config);
@@ -179,8 +173,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
179 get { return false; } 173 get { return false; }
180 } 174 }
181 175
182
183
184 #endregion 176 #endregion
185 177
186 /// <summary> 178 /// <summary>
@@ -194,4 +186,4 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
194 private bool _PleaseShutdown = false; 186 private bool _PleaseShutdown = false;
195 187
196 } 188 }
197} \ No newline at end of file 189}
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
index 6661fcc..12d26fc 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
@@ -249,7 +249,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
249 { 249 {
250 if (LUQueue.Count >= LoadUnloadMaxQueueSize) 250 if (LUQueue.Count >= LoadUnloadMaxQueueSize)
251 { 251 {
252 m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "ERROR: Load/unload queue item count is at " + LUQueue.Count + ". Config variable \"LoadUnloadMaxQueueSize\" is set to " + LoadUnloadMaxQueueSize + ", so ignoring new script."); 252 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: ERROR: Load/unload queue item count is at " + LUQueue.Count + ". Config variable \"LoadUnloadMaxQueueSize\" is set to " + LoadUnloadMaxQueueSize + ", so ignoring new script.");
253 return; 253 return;
254 } 254 }
255 255
@@ -299,7 +299,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
299 Console.WriteLine("ScriptEngine: Inside ExecuteEvent for event " + FunctionName); 299 Console.WriteLine("ScriptEngine: Inside ExecuteEvent for event " + FunctionName);
300#endif 300#endif
301 // Execute a function in the script 301 // Execute a function in the script
302 //m_scriptEngine.Log.Verbose(ScriptEngineName, "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); 302 //m_scriptEngine.Log.Info("[" + ScriptEngineName + "]: Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
303 //ScriptBaseInterface Script = (ScriptBaseInterface)GetScript(localID, itemID); 303 //ScriptBaseInterface Script = (ScriptBaseInterface)GetScript(localID, itemID);
304 IScript Script = GetScript(localID, itemID); 304 IScript Script = GetScript(localID, itemID);
305 if (Script == null) 305 if (Script == null)
@@ -418,4 +418,4 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
418 private bool _PleaseShutdown = false; 418 private bool _PleaseShutdown = false;
419 419
420 } 420 }
421} \ No newline at end of file 421}
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs
index 38f7e7b..d5031c8 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs
@@ -79,12 +79,12 @@ namespace OpenSim.Region.ScriptEngine.Common
79 { 79 {
80 RemoteEvents Events(); 80 RemoteEvents Events();
81 } 81 }
82
82 public interface ScriptEngine 83 public interface ScriptEngine
83 { 84 {
84 RemoteEvents EventManager(); 85 RemoteEvents EventManager();
85 void InitializeEngine(Scene Sceneworld, IConfigSource config, LogBase logger, bool DontHookUp, ScriptManager newScriptManager); 86 void InitializeEngine(Scene Sceneworld, IConfigSource config, bool DontHookUp, ScriptManager newScriptManager);
86 ScriptManager GetScriptManager(); 87 ScriptManager GetScriptManager();
87 } 88 }
88
89 } 89 }
90} 90}