diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/MainServer.cs | 101 |
1 files changed, 79 insertions, 22 deletions
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index 7402c73..72f9cce 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs | |||
@@ -48,9 +48,12 @@ namespace OpenSim.Framework.Servers | |||
48 | /// Control the printing of certain debug messages. | 48 | /// Control the printing of certain debug messages. |
49 | /// </summary> | 49 | /// </summary> |
50 | /// <remarks> | 50 | /// <remarks> |
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 time taken to fulfill the request is 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. | ||
54 | /// </remarks> | 57 | /// </remarks> |
55 | public static int DebugLevel | 58 | public static int DebugLevel |
56 | { | 59 | { |
@@ -102,7 +105,6 @@ namespace OpenSim.Framework.Servers | |||
102 | get { return new Dictionary<uint, BaseHttpServer>(m_Servers); } | 105 | get { return new Dictionary<uint, BaseHttpServer>(m_Servers); } |
103 | } | 106 | } |
104 | 107 | ||
105 | |||
106 | public static void RegisterHttpConsoleCommands(ICommandConsole console) | 108 | public static void RegisterHttpConsoleCommands(ICommandConsole console) |
107 | { | 109 | { |
108 | console.Commands.AddCommand( | 110 | console.Commands.AddCommand( |
@@ -111,15 +113,20 @@ namespace OpenSim.Framework.Servers | |||
111 | "Show all registered http handlers", HandleShowHttpHandlersCommand); | 113 | "Show all registered http handlers", HandleShowHttpHandlersCommand); |
112 | 114 | ||
113 | console.Commands.AddCommand( | 115 | console.Commands.AddCommand( |
114 | "Debug", false, "debug http", "debug http [<level>]", | 116 | "Debug", false, "debug http", "debug http <in|out|all> [<level>]", |
115 | "Turn on inbound non-poll http request debugging.", | 117 | "Turn on http request logging.", |
116 | "If level <= 0, then no extra logging is done.\n" | 118 | "If in or all and\n" |
117 | + "If level >= 1, then short warnings are logged when receiving bad input data.\n" | 119 | + " level <= 0 then no extra logging is done.\n" |
118 | + "If level >= 2, then long warnings are logged when receiving bad input data.\n" | 120 | + " level >= 1 then short warnings are logged when receiving bad input data.\n" |
119 | + "If level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n" | 121 | + " level >= 2 then long warnings are logged when receiving bad input data.\n" |
120 | + "If level >= 4, then a sample from the beginning of the incoming data is logged.\n" | 122 | + " level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n" |
121 | + "If level >= 5, then the entire incoming data is logged.\n" | 123 | + " level >= 4 then the time taken to fulfill the request is logged.\n" |
122 | + "If no level is specified then the current level is returned.", | 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" | ||
126 | + " no level is specified then the current level is returned.\n\n" | ||
127 | + "If out or all and\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", | ||
123 | HandleDebugHttpCommand); | 130 | HandleDebugHttpCommand); |
124 | } | 131 | } |
125 | 132 | ||
@@ -127,24 +134,74 @@ namespace OpenSim.Framework.Servers | |||
127 | /// Turn on some debugging values for OpenSim. | 134 | /// Turn on some debugging values for OpenSim. |
128 | /// </summary> | 135 | /// </summary> |
129 | /// <param name="args"></param> | 136 | /// <param name="args"></param> |
130 | private static void HandleDebugHttpCommand(string module, string[] args) | 137 | private static void HandleDebugHttpCommand(string module, string[] cmdparams) |
131 | { | 138 | { |
132 | if (args.Length == 3) | 139 | if (cmdparams.Length < 3) |
140 | { | ||
141 | MainConsole.Instance.Output("Usage: debug http <in|out|all> 0..6"); | ||
142 | return; | ||
143 | } | ||
144 | |||
145 | bool inReqs = false; | ||
146 | bool outReqs = false; | ||
147 | bool allReqs = false; | ||
148 | |||
149 | string subCommand = cmdparams[2]; | ||
150 | |||
151 | if (subCommand.ToLower() == "in") | ||
152 | { | ||
153 | inReqs = true; | ||
154 | } | ||
155 | else if (subCommand.ToLower() == "out") | ||
156 | { | ||
157 | outReqs = true; | ||
158 | } | ||
159 | else if (subCommand.ToLower() == "all") | ||
160 | { | ||
161 | allReqs = true; | ||
162 | } | ||
163 | else | ||
133 | { | 164 | { |
165 | MainConsole.Instance.Output("You must specify in, out or all"); | ||
166 | return; | ||
167 | } | ||
168 | |||
169 | if (cmdparams.Length >= 4) | ||
170 | { | ||
171 | string rawNewDebug = cmdparams[3]; | ||
134 | int newDebug; | 172 | int newDebug; |
135 | if (int.TryParse(args[2], out newDebug)) | 173 | |
174 | if (!int.TryParse(rawNewDebug, out newDebug)) | ||
175 | { | ||
176 | MainConsole.Instance.OutputFormat("{0} is not a valid debug level", rawNewDebug); | ||
177 | return; | ||
178 | } | ||
179 | |||
180 | if (newDebug < 0 || newDebug > 5) | ||
181 | { | ||
182 | MainConsole.Instance.OutputFormat("{0} is outside the valid debug level range of 0..5", newDebug); | ||
183 | return; | ||
184 | } | ||
185 | |||
186 | if (allReqs || inReqs) | ||
136 | { | 187 | { |
137 | MainServer.DebugLevel = newDebug; | 188 | MainServer.DebugLevel = newDebug; |
138 | MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug); | 189 | MainConsole.Instance.OutputFormat("IN debug level set to {0}", newDebug); |
190 | } | ||
191 | |||
192 | if (allReqs || outReqs) | ||
193 | { | ||
194 | WebUtil.DebugLevel = newDebug; | ||
195 | MainConsole.Instance.OutputFormat("OUT debug level set to {0}", newDebug); | ||
139 | } | 196 | } |
140 | } | ||
141 | else if (args.Length == 2) | ||
142 | { | ||
143 | MainConsole.Instance.OutputFormat("Current debug http level is {0}", MainServer.DebugLevel); | ||
144 | } | 197 | } |
145 | else | 198 | else |
146 | { | 199 | { |
147 | MainConsole.Instance.Output("Usage: debug http 0..5"); | 200 | if (allReqs || inReqs) |
201 | MainConsole.Instance.OutputFormat("Current IN debug level is {0}", MainServer.DebugLevel); | ||
202 | |||
203 | if (allReqs || outReqs) | ||
204 | MainConsole.Instance.OutputFormat("Current OUT debug level is {0}", WebUtil.DebugLevel); | ||
148 | } | 205 | } |
149 | } | 206 | } |
150 | 207 | ||