From 88f7a833dc1176afa802060317ea78ecf6818800 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 29 Apr 2014 09:58:03 +0300 Subject: [PATCH] Improved HTTP logging --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- OpenSim/Framework/WebUtil.cs | 5 ++--- .../Connectors/Inventory/XInventoryServicesConnector.cs | 7 ++++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index e8aa278175..b92c25b1f9 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -705,7 +705,7 @@ namespace OpenSim.Framework.Servers.HttpServer } } - WebUtil.LogResponseDetail(null, output); + WebUtil.LogResponseDetail(RequestNumber, output); } if (!response.SendChunked && response.ContentLength64 <= 0) diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index d7f6bc8ffe..70fab77809 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -214,10 +214,9 @@ namespace OpenSim.Framework LogOutgoingDetail(string.Format("RESPONSE {0}: ", reqnum), inputStream); } - public static void LogResponseDetail(int? reqnum, string input) + public static void LogResponseDetail(int reqnum, string input) { - string context = (reqnum == null) ? "" : string.Format("RESPONSE {0}: ", reqnum.Value); - LogOutgoingDetail(context, input); + LogOutgoingDetail(string.Format("RESPONSE {0}: ", reqnum), input); } private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc) diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index d258293f11..85d105e549 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs @@ -494,7 +494,12 @@ namespace OpenSim.Services.Connectors private Dictionary MakeRequest(string method, Dictionary sendData) { - sendData["METHOD"] = method; + // Add "METHOD" as the first key in the dictionary. This ensures that it will be + // visible even when using partial logging ("debug http all 5"). + Dictionary temp = sendData; + sendData = new Dictionary{ { "METHOD", method } }; + foreach (KeyValuePair kvp in temp) + sendData.Add(kvp.Key, kvp.Value); string reply = string.Empty; lock (m_Lock)