diff options
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 10 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/MainServer.cs | 87 |
2 files changed, 70 insertions, 27 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 43a19fa..f93b3dd 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -529,7 +529,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
529 | 529 | ||
530 | if (DebugLevel >= 3) | 530 | if (DebugLevel >= 3) |
531 | m_log.DebugFormat( | 531 | m_log.DebugFormat( |
532 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", | 532 | "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2}", |
533 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); | 533 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); |
534 | 534 | ||
535 | buffer = HandleHTTPRequest(request, response); | 535 | buffer = HandleHTTPRequest(request, response); |
@@ -541,7 +541,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
541 | 541 | ||
542 | if (DebugLevel >= 3) | 542 | if (DebugLevel >= 3) |
543 | m_log.DebugFormat( | 543 | m_log.DebugFormat( |
544 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", | 544 | "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2}", |
545 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); | 545 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); |
546 | 546 | ||
547 | buffer = HandleLLSDRequests(request, response); | 547 | buffer = HandleLLSDRequests(request, response); |
@@ -649,7 +649,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
649 | private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler) | 649 | private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler) |
650 | { | 650 | { |
651 | m_log.DebugFormat( | 651 | m_log.DebugFormat( |
652 | "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}", | 652 | "[BASE HTTP SERVER]: HTTP IN stream handler {0} {1} {2} {3}", |
653 | request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); | 653 | request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); |
654 | 654 | ||
655 | if (DebugLevel >= 4) | 655 | if (DebugLevel >= 4) |
@@ -659,7 +659,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
659 | private void LogIncomingToContentTypeHandler(OSHttpRequest request) | 659 | private void LogIncomingToContentTypeHandler(OSHttpRequest request) |
660 | { | 660 | { |
661 | m_log.DebugFormat( | 661 | m_log.DebugFormat( |
662 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", | 662 | "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2}", |
663 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); | 663 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); |
664 | 664 | ||
665 | if (DebugLevel >= 4) | 665 | if (DebugLevel >= 4) |
@@ -669,7 +669,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
669 | private void LogIncomingToXmlRpcHandler(OSHttpRequest request) | 669 | private void LogIncomingToXmlRpcHandler(OSHttpRequest request) |
670 | { | 670 | { |
671 | m_log.DebugFormat( | 671 | m_log.DebugFormat( |
672 | "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}", | 672 | "[BASE HTTP SERVER]: HTTP IN assumed generic XMLRPC request {0} {1}", |
673 | request.HttpMethod, request.Url.PathAndQuery); | 673 | request.HttpMethod, request.Url.PathAndQuery); |
674 | 674 | ||
675 | if (DebugLevel >= 4) | 675 | if (DebugLevel >= 4) |
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index 7402c73..b7a133e 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs | |||
@@ -48,9 +48,11 @@ 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 start of the body of incoming non-poll HTTP requests will be logged. | ||
55 | /// If DebugLevel >= 5 then the entire body of incoming non-poll HTTP requests will be logged. | ||
54 | /// </remarks> | 56 | /// </remarks> |
55 | public static int DebugLevel | 57 | public static int DebugLevel |
56 | { | 58 | { |
@@ -102,7 +104,6 @@ namespace OpenSim.Framework.Servers | |||
102 | get { return new Dictionary<uint, BaseHttpServer>(m_Servers); } | 104 | get { return new Dictionary<uint, BaseHttpServer>(m_Servers); } |
103 | } | 105 | } |
104 | 106 | ||
105 | |||
106 | public static void RegisterHttpConsoleCommands(ICommandConsole console) | 107 | public static void RegisterHttpConsoleCommands(ICommandConsole console) |
107 | { | 108 | { |
108 | console.Commands.AddCommand( | 109 | console.Commands.AddCommand( |
@@ -111,15 +112,18 @@ namespace OpenSim.Framework.Servers | |||
111 | "Show all registered http handlers", HandleShowHttpHandlersCommand); | 112 | "Show all registered http handlers", HandleShowHttpHandlersCommand); |
112 | 113 | ||
113 | console.Commands.AddCommand( | 114 | console.Commands.AddCommand( |
114 | "Debug", false, "debug http", "debug http [<level>]", | 115 | "Debug", false, "debug http", "debug http <in|out|all> [<level>]", |
115 | "Turn on inbound non-poll http request debugging.", | 116 | "Turn on http request logging.", |
116 | "If level <= 0, then no extra logging is done.\n" | 117 | "If in or all and\n" |
117 | + "If level >= 1, then short warnings are logged when receiving bad input data.\n" | 118 | + " level <= 0, then no extra logging is done.\n" |
118 | + "If level >= 2, then long warnings are logged when receiving bad input data.\n" | 119 | + " 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" | 120 | + " 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" | 121 | + " 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" | 122 | + " level >= 4, then a sample from the beginning of the incoming data is logged.\n" |
122 | + "If no level is specified then the current level is returned.", | 123 | + " level >= 5, then the entire incoming data is logged.\n" |
124 | + " no level is specified then the current level is returned.\n\n" | ||
125 | + "If out or all and\n" | ||
126 | + " level >= 3. then short notices about all outgoing requests going through WebUtil are logged.\n", | ||
123 | HandleDebugHttpCommand); | 127 | HandleDebugHttpCommand); |
124 | } | 128 | } |
125 | 129 | ||
@@ -127,24 +131,63 @@ namespace OpenSim.Framework.Servers | |||
127 | /// Turn on some debugging values for OpenSim. | 131 | /// Turn on some debugging values for OpenSim. |
128 | /// </summary> | 132 | /// </summary> |
129 | /// <param name="args"></param> | 133 | /// <param name="args"></param> |
130 | private static void HandleDebugHttpCommand(string module, string[] args) | 134 | private static void HandleDebugHttpCommand(string module, string[] cmdparams) |
131 | { | 135 | { |
132 | if (args.Length == 3) | 136 | if (cmdparams.Length < 3) |
133 | { | 137 | { |
138 | MainConsole.Instance.Output("Usage: debug http <in|out|all> 0..5"); | ||
139 | return; | ||
140 | } | ||
141 | |||
142 | bool inReqs = false; | ||
143 | bool outReqs = false; | ||
144 | bool allReqs = false; | ||
145 | |||
146 | string subCommand = cmdparams[2]; | ||
147 | |||
148 | if (subCommand == "in") | ||
149 | inReqs = true; | ||
150 | else if (subCommand == "out") | ||
151 | outReqs = true; | ||
152 | else | ||
153 | allReqs = true; | ||
154 | |||
155 | if (cmdparams.Length >= 4) | ||
156 | { | ||
157 | string rawNewDebug = cmdparams[3]; | ||
134 | int newDebug; | 158 | int newDebug; |
135 | if (int.TryParse(args[2], out newDebug)) | 159 | |
160 | if (!int.TryParse(rawNewDebug, out newDebug)) | ||
161 | { | ||
162 | MainConsole.Instance.OutputFormat("{0} is not a valid debug level", rawNewDebug); | ||
163 | return; | ||
164 | } | ||
165 | |||
166 | if (newDebug < 0 || newDebug > 5) | ||
167 | { | ||
168 | MainConsole.Instance.OutputFormat("{0} is outside the valid debug level range of 0..5", newDebug); | ||
169 | return; | ||
170 | } | ||
171 | |||
172 | if (allReqs || inReqs) | ||
136 | { | 173 | { |
137 | MainServer.DebugLevel = newDebug; | 174 | MainServer.DebugLevel = newDebug; |
138 | MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug); | 175 | MainConsole.Instance.OutputFormat("In debug level set to {0}", newDebug); |
176 | } | ||
177 | |||
178 | if (allReqs || outReqs) | ||
179 | { | ||
180 | WebUtil.DebugLevel = newDebug; | ||
181 | MainConsole.Instance.OutputFormat("Out debug level set to {0}", newDebug); | ||
139 | } | 182 | } |
140 | } | ||
141 | else if (args.Length == 2) | ||
142 | { | ||
143 | MainConsole.Instance.OutputFormat("Current debug http level is {0}", MainServer.DebugLevel); | ||
144 | } | 183 | } |
145 | else | 184 | else |
146 | { | 185 | { |
147 | MainConsole.Instance.Output("Usage: debug http 0..5"); | 186 | if (allReqs || inReqs) |
187 | MainConsole.Instance.OutputFormat("Current in debug level is {0}", MainServer.DebugLevel); | ||
188 | |||
189 | if (allReqs || outReqs) | ||
190 | MainConsole.Instance.OutputFormat("Current out debug level is {0}", WebUtil.DebugLevel); | ||
148 | } | 191 | } |
149 | } | 192 | } |
150 | 193 | ||