Browse Source

[1897] Log HTTP messages through logging system

Jelte Jansen 12 years ago
parent
commit
769bbb5edb
2 changed files with 14 additions and 0 deletions
  1. 8 0
      src/bin/stats/stats_httpd.py.in
  2. 6 0
      src/bin/stats/stats_httpd_messages.mes

+ 8 - 0
src/bin/stats/stats_httpd.py.in

@@ -201,6 +201,14 @@ class HttpHandler(http.server.BaseHTTPRequestHandler):
             self.end_headers()
             self.end_headers()
             return body
             return body
 
 
+    def log_message(self, format, *args):
+        """overrides the parent method log_message()
+        to use the bind10 logging framework.
+        """
+        logger.debug(DBG_STATHTTPD_MESSAGING, STATHTTPD_HTTPLOG,
+                     self.address_string(),
+                     format%args)
+
 class HttpServerError(Exception):
 class HttpServerError(Exception):
     """Exception class for HttpServer class. It is intended to be
     """Exception class for HttpServer class. It is intended to be
     passed from the HttpServer object to the StatsHttpd object."""
     passed from the HttpServer object to the StatsHttpd object."""

+ 6 - 0
src/bin/stats/stats_httpd_messages.mes

@@ -96,3 +96,9 @@ configuration is unknown. The new configuration is ignored, and an
 error is sent back. As possible cause is that there was an upgrade
 error is sent back. As possible cause is that there was an upgrade
 problem, and the stats-httpd version is out of sync with the rest of
 problem, and the stats-httpd version is out of sync with the rest of
 the system.
 the system.
+
+% STATHTTPD_HTTPLOG %1 %2
+Debug HTTP log message. These are the messages logged by the http server
+instance. For most logs, the message shows HTTP client and query
+information like HTTP method, URI, and status code, but the http server
+can also log other information, such as extended status reports.