[Twisted-Python] ReverseProxy does not log requests
Lance Kurisaki
twisted-python@twistedmatrix.com
Mon, 2 Jun 2003 22:21:29 -0500
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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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'] =3D self.host
request.received_headers["x-forwarded-for"] =3D
request.client[1]
request.content.seek(0, 0)
***************
*** 185,189 ****
--- 187,194 ----
request.getAllHeaders(),
request.content.read(),
request)
+
+ clientFactory.noisy =3D 0
+
reactor.connectTCP(self.host, self.port, clientFactory)
return server.NOT_DONE_YET