Log information about which function, request data and agent ID triggered an XmlRpcGroupsServiceConnector error

0.8.0.3
Justin Clark-Casey (justincc) 2014-02-14 21:28:45 +00:00
parent ffd0da23fb
commit 733e067958
2 changed files with 29 additions and 14 deletions

View File

@ -1745,6 +1745,30 @@ namespace OpenSim.Framework
return data; return data;
} }
/// <summary>
/// Pretty format the hashtable contents to a single line.
/// </summary>
/// <remarks>
/// Used for debugging output.
/// </remarks>
/// <param name='ht'></param>
public static string PrettyFormatToSingleLine(Hashtable ht)
{
StringBuilder sb = new StringBuilder();
int i = 0;
foreach (string key in ht.Keys)
{
sb.AppendFormat("{0}:{1}", key, ht[key]);
if (++i < ht.Count)
sb.AppendFormat(", ");
}
return sb.ToString();
}
/// <summary> /// <summary>
/// Used to trigger an early library load on Windows systems. /// Used to trigger an early library load on Windows systems.
/// </summary> /// </summary>

View File

@ -1012,7 +1012,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
Hashtable respData = (Hashtable)resp.Value; Hashtable respData = (Hashtable)resp.Value;
if (respData.Contains("error") && !respData.Contains("succeed")) if (respData.Contains("error") && !respData.Contains("succeed"))
{ {
LogRespDataToConsoleError(respData); LogRespDataToConsoleError(requestingAgentID, function, param, respData);
} }
return respData; return respData;
@ -1040,20 +1040,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
return error; return error;
} }
private void LogRespDataToConsoleError(Hashtable respData) private void LogRespDataToConsoleError(UUID requestingAgentID, string function, Hashtable param, Hashtable respData)
{ {
m_log.Error("[XMLRPC-GROUPS-CONNECTOR]: Error:"); m_log.ErrorFormat(
"[XMLRPC-GROUPS-CONNECTOR]: Error when calling {0} for {1} with params {2}. Response params are {3}",
foreach (string key in respData.Keys) function, requestingAgentID, Util.PrettyFormatToSingleLine(param), Util.PrettyFormatToSingleLine(respData));
{
m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Key: {0}", key);
string[] lines = respData[key].ToString().Split(new char[] { '\n' });
foreach (string line in lines)
{
m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", line);
}
}
} }
/// <summary> /// <summary>