From 13d9b64b1d8f7be77e6eaf17f7f85c1c43d6a9ff Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 26 Jan 2012 00:28:51 +0000 Subject: Re-enable error logging associated with assembly and script loading failure in ScriptInstance. Swallowing exceptions just leads to more mysterious failures later on. --- .../ScriptEngine/Shared/Instance/ScriptInstance.cs | 28 +++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index f9d6eee..9b93135 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance { public class ScriptInstance : MarshalByRefObject, IScriptInstance { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IScriptEngine m_Engine; private IScriptWorkItem m_CurrentResult = null; @@ -109,7 +109,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance private Dictionary m_Apis = new Dictionary(); // Script state - private string m_State="default"; + private string m_State = "default"; public Object[] PluginData = new Object[0]; @@ -127,6 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance m_minEventDelay = value; else m_minEventDelay = 0.0; + m_eventDelayTicks = (long)(m_minEventDelay * 10000000L); m_nextEventTimeTicks = DateTime.Now.Ticks; } @@ -296,9 +297,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance //RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); // lease.Register(this); } - catch (Exception) + catch (Exception e) { - // m_log.ErrorFormat("[Script] Error loading assembly {0}\n"+e.ToString(), assembly); + m_log.ErrorFormat( + "[SCRIPT INSTANCE]: Error loading assembly {0}. Exception {1}{2}", + assembly, e.Message, e.StackTrace); } try @@ -313,9 +316,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance part.SetScriptEvents(m_ItemID, (int)m_Script.GetStateEventFlags(State)); } - catch (Exception) + catch (Exception e) { - // m_log.Error("[Script] Error loading script instance\n"+e.ToString()); + m_log.ErrorFormat( + "[SCRIPT INSTANCE]: Error loading script instance from assembly {0}. Exception {1}{2}", + assembly, e.Message, e.StackTrace); + return; } @@ -377,12 +383,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance } else { - // m_log.Error("[Script] Unable to load script state: Memory limit exceeded"); + m_log.ErrorFormat( + "[SCRIPT INSTANCE]: Unable to load script state from assembly {0}: Memory limit exceeded", + assembly); } } - catch (Exception) + catch (Exception e) { - // m_log.ErrorFormat("[Script] Unable to load script state from xml: {0}\n"+e.ToString(), xml); + m_log.ErrorFormat( + "[SCRIPT INSTANCE]: Unable to load script state from assembly {0}. XML is {1}. Exception {2}{3}", + assembly, xml, e.Message, e.StackTrace); } } // else -- cgit v1.1