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
user_profiles
Justin Clark-Casey (justincc) 2013-01-23 23:34:15 +00:00
parent cf168194e5
commit 72dd3633ee
3 changed files with 31 additions and 28 deletions

View File

@ -284,9 +284,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
else
{
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"
+ " 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;
}
@ -324,8 +325,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
catch (Exception e)
{
m_log.ErrorFormat(
"[SCRIPT INSTANCE]: Error loading assembly {0}. Exception {1}{2}",
assembly, e.Message, e.StackTrace);
"[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}",
ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, assembly, e.Message, e.StackTrace);
return false;
}
@ -345,8 +346,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
catch (Exception e)
{
m_log.ErrorFormat(
"[SCRIPT INSTANCE]: Error loading script instance from assembly {0}. Exception {1}{2}",
assembly, e.Message, e.StackTrace);
"[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}",
ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, e.Message, e.StackTrace);
return false;
}
@ -401,15 +402,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
else
{
m_log.WarnFormat(
"[SCRIPT INSTANCE]: Unable to load script state file {0} for script {1} {2} in {3} {4} (assembly {5}). Memory limit exceeded",
savedState, ScriptName, ItemID, PrimName, ObjectID, assembly);
"[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.",
ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, savedState);
}
}
catch (Exception e)
{
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}",
savedState, ScriptName, ItemID, PrimName, ObjectID, assembly, xml, e.Message, e.StackTrace);
"[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}",
ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, savedState, xml, e.Message, e.StackTrace);
}
}
// else
@ -598,9 +599,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
}
else
{
m_log.DebugFormat(
"[SCRIPT INSTANCE]: Co-operatively stopping script {0} {1} in {2} {3}",
ScriptName, ItemID, PrimName, ObjectID);
if (DebugLevel >= 1)
m_log.DebugFormat(
"[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.
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.
if (workItem.Wait(TimeSpan.MaxValue))
{
m_log.DebugFormat(
"[SCRIPT INSTANCE]: Co-operatively stopped script {0} {1} in {2} {3}",
ScriptName, ItemID, PrimName, ObjectID);
if (DebugLevel >= 1)
m_log.DebugFormat(
"[SCRIPT INSTANCE]: Co-operatively stopped script {0} {1} in {2} {3}",
ScriptName, ItemID, PrimName, ObjectID);
return true;
}
@ -922,9 +925,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
}
else if ((e is TargetInvocationException) && (e.InnerException is ScriptCoopStopException))
{
m_log.DebugFormat(
"[SCRIPT INSTANCE]: Script {0}.{1} in event {2}, state {3} stopped co-operatively.",
PrimName, ScriptName, data.EventName, State);
if (DebugLevel >= 1)
m_log.DebugFormat(
"[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;
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.OnObjectGrab += touch_start;
myScriptEngine.World.EventManager.OnObjectGrabbing += touch;
@ -69,7 +69,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
myScriptEngine.World.EventManager.OnScriptLandColliderStart += land_collision_start;
myScriptEngine.World.EventManager.OnScriptLandColliding += land_collision;
myScriptEngine.World.EventManager.OnScriptLandColliderEnd += land_collision_end;
IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>();
IMoneyModule money = myScriptEngine.World.RequestModuleInterface<IMoneyModule>();
if (money != null)
{
money.OnObjectPaid+=HandleObjectPaid;

View File

@ -241,7 +241,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
m_ScriptConfig = configSource.Configs["XEngine"];
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";
ScriptBaseClassName = typeof(XEngineScriptBase).FullName;
@ -261,15 +265,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{
if (m_ScriptConfig == null)
return;
m_ScriptFailCount = 0;
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);
if (!m_Enabled)