From 1f402fdf5e8ef53a07f98c4447946805791d26bc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 7 Feb 2012 21:40:28 +0000 Subject: Add url to logging if SynchronousRestFormsRequester.MakRequest() throws an exception in service connectors --- .../Connectors/Friends/FriendsServiceConnector.cs | 22 +++++++++------------- .../Connectors/Friends/FriendsSimConnector.cs | 9 ++++----- 2 files changed, 13 insertions(+), 18 deletions(-) (limited to 'OpenSim/Services/Connectors/Friends') diff --git a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs index 41361ab..44138c9 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs @@ -108,12 +108,11 @@ namespace OpenSim.Services.Connectors.Friends protected FriendInfo[] GetFriends(Dictionary sendData, string PrincipalID) { string reqString = ServerUtils.BuildQueryString(sendData); + string uri = m_ServerURI + "/friends"; try { - string reply = SynchronousRestFormsRequester.MakeRequest("POST", - m_ServerURI + "/friends", - reqString); + string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); if (reply != string.Empty) { Dictionary replyData = ServerUtils.ParseXmlResponse(reply); @@ -143,7 +142,6 @@ namespace OpenSim.Services.Connectors.Friends // Success return finfos.ToArray(); } - else m_log.DebugFormat("[FRIENDS SERVICE CONNECTOR]: GetFriends {0} received null response", PrincipalID); @@ -152,7 +150,7 @@ namespace OpenSim.Services.Connectors.Friends } catch (Exception e) { - m_log.DebugFormat("[FRIENDS SERVICE CONNECTOR]: Exception when contacting friends server: {0}", e.Message); + m_log.DebugFormat("[FRIENDS SERVICE CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message); } return new FriendInfo[0]; @@ -167,15 +165,14 @@ namespace OpenSim.Services.Connectors.Friends sendData["METHOD"] = "storefriend"; string reply = string.Empty; + string uri = m_ServerURI + "/friends"; try { - reply = SynchronousRestFormsRequester.MakeRequest("POST", - m_ServerURI + "/friends", - ServerUtils.BuildQueryString(sendData)); + reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); } catch (Exception e) { - m_log.DebugFormat("[FRIENDS SERVICE CONNECTOR]: Exception when contacting friends server: {0}", e.Message); + m_log.DebugFormat("[FRIENDS SERVICE CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message); return false; } @@ -223,15 +220,14 @@ namespace OpenSim.Services.Connectors.Friends public bool Delete(Dictionary sendData, string PrincipalID, string Friend) { string reply = string.Empty; + string uri = m_ServerURI = "/friends"; try { - reply = SynchronousRestFormsRequester.MakeRequest("POST", - m_ServerURI + "/friends", - ServerUtils.BuildQueryString(sendData)); + reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); } catch (Exception e) { - m_log.DebugFormat("[FRIENDS SERVICE CONNECTOR]: Exception when contacting friends server: {0}", e.Message); + m_log.DebugFormat("[FRIENDS SERVICE CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message); return false; } diff --git a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs index d0a20fc..eea9853 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs @@ -139,12 +139,11 @@ namespace OpenSim.Services.Connectors.Friends return false; m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: region: {0}", region.ExternalHostName + ":" + region.HttpPort); + string uri = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/friends"; + try { - string url = "http://" + region.ExternalHostName + ":" + region.HttpPort; - string reply = SynchronousRestFormsRequester.MakeRequest("POST", - url + "/friends", - reqString); + string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); if (reply != string.Empty) { Dictionary replyData = ServerUtils.ParseXmlResponse(reply); @@ -165,7 +164,7 @@ namespace OpenSim.Services.Connectors.Friends } catch (Exception e) { - m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: Exception when contacting remote sim: {0}", e.ToString()); + m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: Exception when contacting remote sim at {0}: {1}", uri, e.Message); } return false; -- cgit v1.1