aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/MainServer.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-09-20 23:18:19 +0100
committerJustin Clark-Casey (justincc)2012-09-20 23:18:19 +0100
commita5b3989e5db0a3b22e44b84412227a8e487bcef2 (patch)
tree31b2f0293de73d102f0f8d08975655cf993c8137 /OpenSim/Framework/Servers/MainServer.cs
parentAdd ability to turn on/off logging of outgoing HTTP requests flowing through ... (diff)
downloadopensim-SC_OLD-a5b3989e5db0a3b22e44b84412227a8e487bcef2.zip
opensim-SC_OLD-a5b3989e5db0a3b22e44b84412227a8e487bcef2.tar.gz
opensim-SC_OLD-a5b3989e5db0a3b22e44b84412227a8e487bcef2.tar.bz2
opensim-SC_OLD-a5b3989e5db0a3b22e44b84412227a8e487bcef2.tar.xz
Insert a new log level 4 for HTTP IN and HTTP OUT that will log how long the request took.
This is only printed if debug http level >= 4 and the request didn't take more than the time considered 'long', in which case the existing log message is printed. This displaces the previous log levels 4 and 5 which are now 5 and 6 respectively.
Diffstat (limited to 'OpenSim/Framework/Servers/MainServer.cs')
-rw-r--r--OpenSim/Framework/Servers/MainServer.cs48
1 files changed, 31 insertions, 17 deletions
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs
index b7a133e..72f9cce 100644
--- a/OpenSim/Framework/Servers/MainServer.cs
+++ b/OpenSim/Framework/Servers/MainServer.cs
@@ -51,8 +51,9 @@ namespace OpenSim.Framework.Servers
51 /// If DebugLevel >= 1 then short warnings are logged when receiving bad input data. 51 /// If DebugLevel >= 1 then short warnings are logged when receiving bad input data.
52 /// If DebugLevel >= 2 then long warnings are logged when receiving bad input data. 52 /// If DebugLevel >= 2 then long warnings are logged when receiving bad input data.
53 /// If DebugLevel >= 3 then short notices about all incoming non-poll HTTP requests are logged. 53 /// If DebugLevel >= 3 then short notices about all incoming non-poll HTTP requests are logged.
54 /// If DebugLevel >= 4 then the start of the body of incoming non-poll HTTP requests will be logged. 54 /// If DebugLevel >= 4 then the time taken to fulfill the request is logged.
55 /// If DebugLevel >= 5 then the entire body of incoming non-poll HTTP requests will be logged. 55 /// If DebugLevel >= 5 then the start of the body of incoming non-poll HTTP requests will be logged.
56 /// If DebugLevel >= 6 then the entire body of incoming non-poll HTTP requests will be logged.
56 /// </remarks> 57 /// </remarks>
57 public static int DebugLevel 58 public static int DebugLevel
58 { 59 {
@@ -115,15 +116,17 @@ namespace OpenSim.Framework.Servers
115 "Debug", false, "debug http", "debug http <in|out|all> [<level>]", 116 "Debug", false, "debug http", "debug http <in|out|all> [<level>]",
116 "Turn on http request logging.", 117 "Turn on http request logging.",
117 "If in or all and\n" 118 "If in or all and\n"
118 + " level <= 0, then no extra logging is done.\n" 119 + " level <= 0 then no extra logging is done.\n"
119 + " level >= 1, then short warnings are logged when receiving bad input data.\n" 120 + " level >= 1 then short warnings are logged when receiving bad input data.\n"
120 + " level >= 2, then long warnings are logged when receiving bad input data.\n" 121 + " level >= 2 then long warnings are logged when receiving bad input data.\n"
121 + " level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n" 122 + " level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n"
122 + " level >= 4, then a sample from the beginning of the incoming data is logged.\n" 123 + " level >= 4 then the time taken to fulfill the request is logged.\n"
123 + " level >= 5, then the entire incoming data is logged.\n" 124 + " level >= 5 then a sample from the beginning of the incoming data is logged.\n"
125 + " level >= 6 then the entire incoming data is logged.\n"
124 + " no level is specified then the current level is returned.\n\n" 126 + " no level is specified then the current level is returned.\n\n"
125 + "If out or all and\n" 127 + "If out or all and\n"
126 + " level >= 3. then short notices about all outgoing requests going through WebUtil are logged.\n", 128 + " level >= 3 then short notices about all outgoing requests going through WebUtil are logged.\n"
129 + " level >= 4 then the time taken to fulfill the request is logged.\n",
127 HandleDebugHttpCommand); 130 HandleDebugHttpCommand);
128 } 131 }
129 132
@@ -135,7 +138,7 @@ namespace OpenSim.Framework.Servers
135 { 138 {
136 if (cmdparams.Length < 3) 139 if (cmdparams.Length < 3)
137 { 140 {
138 MainConsole.Instance.Output("Usage: debug http <in|out|all> 0..5"); 141 MainConsole.Instance.Output("Usage: debug http <in|out|all> 0..6");
139 return; 142 return;
140 } 143 }
141 144
@@ -145,12 +148,23 @@ namespace OpenSim.Framework.Servers
145 148
146 string subCommand = cmdparams[2]; 149 string subCommand = cmdparams[2];
147 150
148 if (subCommand == "in") 151 if (subCommand.ToLower() == "in")
152 {
149 inReqs = true; 153 inReqs = true;
150 else if (subCommand == "out") 154 }
155 else if (subCommand.ToLower() == "out")
156 {
151 outReqs = true; 157 outReqs = true;
152 else 158 }
159 else if (subCommand.ToLower() == "all")
160 {
153 allReqs = true; 161 allReqs = true;
162 }
163 else
164 {
165 MainConsole.Instance.Output("You must specify in, out or all");
166 return;
167 }
154 168
155 if (cmdparams.Length >= 4) 169 if (cmdparams.Length >= 4)
156 { 170 {
@@ -172,22 +186,22 @@ namespace OpenSim.Framework.Servers
172 if (allReqs || inReqs) 186 if (allReqs || inReqs)
173 { 187 {
174 MainServer.DebugLevel = newDebug; 188 MainServer.DebugLevel = newDebug;
175 MainConsole.Instance.OutputFormat("In debug level set to {0}", newDebug); 189 MainConsole.Instance.OutputFormat("IN debug level set to {0}", newDebug);
176 } 190 }
177 191
178 if (allReqs || outReqs) 192 if (allReqs || outReqs)
179 { 193 {
180 WebUtil.DebugLevel = newDebug; 194 WebUtil.DebugLevel = newDebug;
181 MainConsole.Instance.OutputFormat("Out debug level set to {0}", newDebug); 195 MainConsole.Instance.OutputFormat("OUT debug level set to {0}", newDebug);
182 } 196 }
183 } 197 }
184 else 198 else
185 { 199 {
186 if (allReqs || inReqs) 200 if (allReqs || inReqs)
187 MainConsole.Instance.OutputFormat("Current in debug level is {0}", MainServer.DebugLevel); 201 MainConsole.Instance.OutputFormat("Current IN debug level is {0}", MainServer.DebugLevel);
188 202
189 if (allReqs || outReqs) 203 if (allReqs || outReqs)
190 MainConsole.Instance.OutputFormat("Current out debug level is {0}", WebUtil.DebugLevel); 204 MainConsole.Instance.OutputFormat("Current OUT debug level is {0}", WebUtil.DebugLevel);
191 } 205 }
192 } 206 }
193 207