Improve logging by making it clearer which script is failing if an assembly fails to load.

Moves the noise co-op start/stop debug log messages to only display if xengine debug level >= 1
Logs which stop strategy is being used (abort or co-op)
Adjusts some other logging to remove not very useful stuff
0.7.4-extended
Justin Clark-Casey (justincc) 2013-01-23 23:34:15 +00:00
parent b2c893a7be
commit af30d9b07e
3 changed files with 31 additions and 28 deletions

View File

@ -284,9 +284,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[SCRIPT INSTANCE]: You must remove all existing script DLLs before using enabling co-op termination" "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}. You must remove all existing {6}* script DLL files before using enabling co-op termination"
+ ", either by setting DeleteScriptsOnStartup = true in [XEngine] for one run" + ", either by setting DeleteScriptsOnStartup = true in [XEngine] for one run"
+ " or by deleting all *.dll* files in the relevant bin/ScriptEngines/<region-id>/ directory"); + " or by deleting these files manually.",
ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, assembly);
return false; return false;
} }
@ -324,8 +325,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[SCRIPT INSTANCE]: Error loading assembly {0}. Exception {1}{2}", "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}. Error loading assembly {6}. Exception {7}{8}",
assembly, e.Message, e.StackTrace); ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, assembly, e.Message, e.StackTrace);
return false; return false;
} }
@ -345,8 +346,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[SCRIPT INSTANCE]: Error loading script instance from assembly {0}. Exception {1}{2}", "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}. Error initializing script instance. Exception {6}{7}",
assembly, e.Message, e.StackTrace); ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, e.Message, e.StackTrace);
return false; return false;
} }
@ -401,15 +402,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
else else
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[SCRIPT INSTANCE]: Unable to load script state file {0} for script {1} {2} in {3} {4} (assembly {5}). Memory limit exceeded", "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}. Unable to load script state file {6}. Memory limit exceeded.",
savedState, ScriptName, ItemID, PrimName, ObjectID, assembly); ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, savedState);
} }
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[SCRIPT INSTANCE]: Unable to load script state file {0} for script {1} {2} in {3} {4} (assembly {5}). XML is {6}. Exception {7}{8}", "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}. Unable to load script state file {6}. XML is {7}. Exception {8}{9}",
savedState, ScriptName, ItemID, PrimName, ObjectID, assembly, xml, e.Message, e.StackTrace); ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, savedState, xml, e.Message, e.StackTrace);
} }
} }
// else // else
@ -598,9 +599,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
} }
else else
{ {
m_log.DebugFormat( if (DebugLevel >= 1)
"[SCRIPT INSTANCE]: Co-operatively stopping script {0} {1} in {2} {3}", m_log.DebugFormat(
ScriptName, ItemID, PrimName, ObjectID); "[SCRIPT INSTANCE]: Co-operatively stopping script {0} {1} in {2} {3}",
ScriptName, ItemID, PrimName, ObjectID);
// This will terminate the event on next handle check by the script. // This will terminate the event on next handle check by the script.
m_coopSleepHandle.Set(); m_coopSleepHandle.Set();
@ -609,9 +611,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
// checking is implemented. May want to allow a shorter timeout option later. // checking is implemented. May want to allow a shorter timeout option later.
if (workItem.Wait(TimeSpan.MaxValue)) if (workItem.Wait(TimeSpan.MaxValue))
{ {
m_log.DebugFormat( if (DebugLevel >= 1)
"[SCRIPT INSTANCE]: Co-operatively stopped script {0} {1} in {2} {3}", m_log.DebugFormat(
ScriptName, ItemID, PrimName, ObjectID); "[SCRIPT INSTANCE]: Co-operatively stopped script {0} {1} in {2} {3}",
ScriptName, ItemID, PrimName, ObjectID);
return true; return true;
} }
@ -922,9 +925,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
} }
else if ((e is TargetInvocationException) && (e.InnerException is ScriptCoopStopException)) else if ((e is TargetInvocationException) && (e.InnerException is ScriptCoopStopException))
{ {
m_log.DebugFormat( if (DebugLevel >= 1)
"[SCRIPT INSTANCE]: Script {0}.{1} in event {2}, state {3} stopped co-operatively.", m_log.DebugFormat(
PrimName, ScriptName, data.EventName, State); "[SCRIPT INSTANCE]: Script {0}.{1} in event {2}, state {3} stopped co-operatively.",
PrimName, ScriptName, data.EventName, State);
} }
} }
} }

View File

@ -52,7 +52,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{ {
myScriptEngine = _ScriptEngine; myScriptEngine = _ScriptEngine;
m_log.Info("[XEngine] Hooking up to server events"); // m_log.Info("[XEngine] Hooking up to server events");
myScriptEngine.World.EventManager.OnAttach += attach; myScriptEngine.World.EventManager.OnAttach += attach;
myScriptEngine.World.EventManager.OnObjectGrab += touch_start; myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
myScriptEngine.World.EventManager.OnObjectGrabbing += touch; myScriptEngine.World.EventManager.OnObjectGrabbing += touch;
@ -69,7 +69,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
myScriptEngine.World.EventManager.OnScriptLandColliderStart += land_collision_start; myScriptEngine.World.EventManager.OnScriptLandColliderStart += land_collision_start;
myScriptEngine.World.EventManager.OnScriptLandColliding += land_collision; myScriptEngine.World.EventManager.OnScriptLandColliding += land_collision;
myScriptEngine.World.EventManager.OnScriptLandColliderEnd += land_collision_end; myScriptEngine.World.EventManager.OnScriptLandColliderEnd += land_collision_end;
IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>(); IMoneyModule money = myScriptEngine.World.RequestModuleInterface<IMoneyModule>();
if (money != null) if (money != null)
{ {
money.OnObjectPaid+=HandleObjectPaid; money.OnObjectPaid+=HandleObjectPaid;

View File

@ -241,7 +241,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
m_ScriptConfig = configSource.Configs["XEngine"]; m_ScriptConfig = configSource.Configs["XEngine"];
m_ConfigSource = configSource; m_ConfigSource = configSource;
if (m_ScriptConfig.GetString("ScriptStopStrategy", "abort") == "co-op") string rawScriptStopStrategy = m_ScriptConfig.GetString("ScriptStopStrategy", "abort");
m_log.InfoFormat("[XEngine]: Script stop strategy is {0}", rawScriptStopStrategy);
if (rawScriptStopStrategy == "co-op")
{ {
ScriptClassName = "XEngineScript"; ScriptClassName = "XEngineScript";
ScriptBaseClassName = typeof(XEngineScriptBase).FullName; ScriptBaseClassName = typeof(XEngineScriptBase).FullName;
@ -261,15 +265,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{ {
if (m_ScriptConfig == null) if (m_ScriptConfig == null)
return; return;
m_ScriptFailCount = 0; m_ScriptFailCount = 0;
m_ScriptErrorMessage = String.Empty; m_ScriptErrorMessage = String.Empty;
if (m_ScriptConfig == null)
{
// m_log.ErrorFormat("[XEngine] No script configuration found. Scripts disabled");
return;
}
m_Enabled = m_ScriptConfig.GetBoolean("Enabled", true); m_Enabled = m_ScriptConfig.GetBoolean("Enabled", true);
if (!m_Enabled) if (!m_Enabled)