aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.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/HttpServer/BaseHttpServer.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/HttpServer/BaseHttpServer.cs')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs47
1 files changed, 32 insertions, 15 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index f93b3dd..4e04dd8 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -54,6 +54,12 @@ namespace OpenSim.Framework.Servers.HttpServer
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); 55 private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
56 56
57 /// <summary>
58 /// Gets or sets the debug level.
59 /// </summary>
60 /// <value>
61 /// See MainServer.DebugLevel.
62 /// </value>
57 public int DebugLevel { get; set; } 63 public int DebugLevel { get; set; }
58 64
59 private volatile int NotSocketErrors = 0; 65 private volatile int NotSocketErrors = 0;
@@ -529,8 +535,8 @@ namespace OpenSim.Framework.Servers.HttpServer
529 535
530 if (DebugLevel >= 3) 536 if (DebugLevel >= 3)
531 m_log.DebugFormat( 537 m_log.DebugFormat(
532 "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2}", 538 "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}",
533 request.ContentType, request.HttpMethod, request.Url.PathAndQuery); 539 request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
534 540
535 buffer = HandleHTTPRequest(request, response); 541 buffer = HandleHTTPRequest(request, response);
536 break; 542 break;
@@ -541,8 +547,8 @@ namespace OpenSim.Framework.Servers.HttpServer
541 547
542 if (DebugLevel >= 3) 548 if (DebugLevel >= 3)
543 m_log.DebugFormat( 549 m_log.DebugFormat(
544 "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2}", 550 "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}",
545 request.ContentType, request.HttpMethod, request.Url.PathAndQuery); 551 request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
546 552
547 buffer = HandleLLSDRequests(request, response); 553 buffer = HandleLLSDRequests(request, response);
548 break; 554 break;
@@ -640,7 +646,18 @@ namespace OpenSim.Framework.Servers.HttpServer
640 uriString, 646 uriString,
641 requestHandler != null ? requestHandler.Name : "", 647 requestHandler != null ? requestHandler.Name : "",
642 requestHandler != null ? requestHandler.Description : "", 648 requestHandler != null ? requestHandler.Description : "",
643 request.RemoteIPEndPoint.ToString(), 649 request.RemoteIPEndPoint,
650 tickdiff);
651 }
652 else if (DebugLevel >= 4)
653 {
654 m_log.DebugFormat(
655 "[BASE HTTP SERVER]: HTTP IN {0} {1} {2} {3} from {4} took {5}ms",
656 requestMethod,
657 uriString,
658 requestHandler != null ? requestHandler.Name : "",
659 requestHandler != null ? requestHandler.Description : "",
660 request.RemoteIPEndPoint,
644 tickdiff); 661 tickdiff);
645 } 662 }
646 } 663 }
@@ -649,30 +666,30 @@ namespace OpenSim.Framework.Servers.HttpServer
649 private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler) 666 private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler)
650 { 667 {
651 m_log.DebugFormat( 668 m_log.DebugFormat(
652 "[BASE HTTP SERVER]: HTTP IN stream handler {0} {1} {2} {3}", 669 "[BASE HTTP SERVER]: HTTP IN stream handler {0} {1} {2} {3} from {4}",
653 request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); 670 request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description, request.RemoteIPEndPoint);
654 671
655 if (DebugLevel >= 4) 672 if (DebugLevel >= 5)
656 LogIncomingInDetail(request); 673 LogIncomingInDetail(request);
657 } 674 }
658 675
659 private void LogIncomingToContentTypeHandler(OSHttpRequest request) 676 private void LogIncomingToContentTypeHandler(OSHttpRequest request)
660 { 677 {
661 m_log.DebugFormat( 678 m_log.DebugFormat(
662 "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2}", 679 "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}",
663 request.ContentType, request.HttpMethod, request.Url.PathAndQuery); 680 request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
664 681
665 if (DebugLevel >= 4) 682 if (DebugLevel >= 5)
666 LogIncomingInDetail(request); 683 LogIncomingInDetail(request);
667 } 684 }
668 685
669 private void LogIncomingToXmlRpcHandler(OSHttpRequest request) 686 private void LogIncomingToXmlRpcHandler(OSHttpRequest request)
670 { 687 {
671 m_log.DebugFormat( 688 m_log.DebugFormat(
672 "[BASE HTTP SERVER]: HTTP IN assumed generic XMLRPC request {0} {1}", 689 "[BASE HTTP SERVER]: HTTP IN assumed generic XMLRPC request {0} {1} from {2}",
673 request.HttpMethod, request.Url.PathAndQuery); 690 request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
674 691
675 if (DebugLevel >= 4) 692 if (DebugLevel >= 5)
676 LogIncomingInDetail(request); 693 LogIncomingInDetail(request);
677 } 694 }
678 695
@@ -682,7 +699,7 @@ namespace OpenSim.Framework.Servers.HttpServer
682 { 699 {
683 string output; 700 string output;
684 701
685 if (DebugLevel == 4) 702 if (DebugLevel == 5)
686 { 703 {
687 const int sampleLength = 80; 704 const int sampleLength = 80;
688 char[] sampleChars = new char[sampleLength]; 705 char[] sampleChars = new char[sampleLength];