[Twisted-Python] ReverseProxy does not log requests

Lance Kurisaki lkurisaki at ambiron.net
Mon Jun 2 23:21:29 EDT 2003


The ReverseProxy does not log its requests.

The following patch adds request logging and silences the "Starting
factory..." and "Stopping factory..." log messages.

I'm not sure if the "proper" place to do the logging is in the render()
method of ReverseProxyResource, but it seems to work... :-)

					Lance


Index: twisted/web/proxy.py
===================================================================
RCS file: /cvs/Twisted/twisted/web/proxy.py,v
retrieving revision 1.13
diff -c -r1.13 proxy.py
*** twisted/web/proxy.py        3 Jun 2003 01:56:22 -0000       1.13
--- twisted/web/proxy.py        3 Jun 2003 03:11:39 -0000
***************
*** 177,182 ****
--- 177,184 ----
          return ReverseProxyResource(self.host, self.port,
self.path+'/'+path)

      def render(self, request):
+       request.channel.factory.log(request)    # log request...
+
          request.received_headers['host'] = self.host
          request.received_headers["x-forwarded-for"] =
request.client[1]
          request.content.seek(0, 0)
***************
*** 185,189 ****
--- 187,194 ----
                                       request.getAllHeaders(),
                                       request.content.read(),
                                       request)
+
+       clientFactory.noisy = 0
+
          reactor.connectTCP(self.host, self.port, clientFactory)
          return server.NOT_DONE_YET




More information about the Twisted-Python mailing list