[Twisted-Python] XMLRPC, how to prevent stdout on post and get?
I have a simple xmlrpc server written using Twisted. Every time I get a request to it, stdout spits out something like the following: 2011-07-19 00:33:39-0700 [HTTPChannel,332,127.0.0.1] 127.0.0.1 - - [19/Jul/2011:07:33:38 +0000] "POST / HTTP/1.0" 200 128 "-" "xmlrpclib.py/1.0.1 (by www.pythonware.com)" How do I prevent this from happening? I also do not want this going to a log file either. Thanks anybody for your help!
On 07:37 am, happybrowndog@hotmail.com wrote:
I have a simple xmlrpc server written using Twisted. Every time I get a request to it, stdout spits out something like the following:
2011-07-19 00:33:39-0700 [HTTPChannel,332,127.0.0.1] 127.0.0.1 - - [19/Jul/2011:07:33:38 +0000] "POST / HTTP/1.0" 200 128 "-" "xmlrpclib.py/1.0.1 (by www.pythonware.com)"
How do I prevent this from happening? I also do not want this going to a log file either.
Thanks anybody for your help!
If not for the logfile rotation that twisted.web.server.Site wants to do, you could pass os.devnull as a logPath to Site's initializer. However, log rotation will like causes this to do something bad. There's a private method that Site overrides (from HTTPFactory) that controls part of this behavior. It might be useful to have a public API for that instead. Would you like to file an enhancement ticket in the issue tracker describing the use case? Jean-Paul
On 7/19/2011 4:37 AM, exarkun@twistedmatrix.com wrote:
If not for the logfile rotation that twisted.web.server.Site wants to do, you could pass os.devnull as a logPath to Site's initializer. However, log rotation will like causes this to do something bad.
There's a private method that Site overrides (from HTTPFactory) that controls part of this behavior. It might be useful to have a public API for that instead.
Would you like to file an enhancement ticket in the issue tracker describing the use case?
Jean-Paul
Yes, I'm interested in this as well. Somewhat different from the OP, I'd like to have a way to turn this logging on and off, and if on, a way to specify the content of the message (in particular, the method and arguments). I've submitted Ticket #5200. -- Don Dwiggins Advanced Publishing Technology
As a quick fix, class QuietSite(server.Site): """Like a Site but quieter""" def log(self, request): pass Then use QuietSite instead of server.Site p. On 19 Jul 2011, at 08:37, hbd666 wrote:
I have a simple xmlrpc server written using Twisted. Every time I get a request to it, stdout spits out something like the following:
2011-07-19 00:33:39-0700 [HTTPChannel,332,127.0.0.1] 127.0.0.1 - - [19/Jul/2011:07:33:38 +0000] "POST / HTTP/1.0" 200 128 "-" "xmlrpclib.py/1.0.1 (by www.pythonware.com)"
How do I prevent this from happening? I also do not want this going to a log file either.
Thanks anybody for your help!
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
On 7/19/2011 11:11 AM, Paul Thomas wrote:
As a quick fix,
class QuietSite(server.Site): """Like a Site but quieter""" def log(self, request): pass
Then use QuietSite instead of server.Site
p. On 19 Jul 2011, at 08:37, hbd666 wrote:
I have a simple xmlrpc server written using Twisted. Every time I get a request to it, stdout spits out something like the following:
2011-07-19 00:33:39-0700 [HTTPChannel,332,127.0.0.1] 127.0.0.1 - - [19/Jul/2011:07:33:38 +0000] "POST / HTTP/1.0" 200 128 "-" "xmlrpclib.py/1.0.1 (by www.pythonware.com)"
How do I prevent this from happening? I also do not want this going to a log file either.
Thanks anybody for your help!
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Thanks, that worked for my application. Though I still do see a need to modify the API as suggested earlier, because it would be more specific to the XMLRPC, and just in case there is more than one protocol for a server site for an application - wouldn't want to kill logging for all protocols.
On 19 Jul, 06:57 pm, happybrowndog@hotmail.com wrote:
On 7/19/2011 11:11 AM, Paul Thomas wrote:
As a quick fix,
class QuietSite(server.Site): """Like a Site but quieter""" def log(self, request): pass
Then use QuietSite instead of server.Site
p. On 19 Jul 2011, at 08:37, hbd666 wrote:
I have a simple xmlrpc server written using Twisted. Every time I get a request to it, stdout spits out something like the following:
2011-07-19 00:33:39-0700 [HTTPChannel,332,127.0.0.1] 127.0.0.1 - - [19/Jul/2011:07:33:38 +0000] "POST / HTTP/1.0" 200 128 "-" "xmlrpclib.py/1.0.1 (by www.pythonware.com)"
How do I prevent this from happening? I also do not want this going to a log file either.
Thanks anybody for your help!
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Thanks, that worked for my application. Though I still do see a need to modify the API as suggested earlier, because it would be more specific to the XMLRPC, and just in case there is more than one protocol for a server site for an application - wouldn't want to kill logging for all protocols.
Hmmm. Site is a factory for HTTP. XML-RPC runs over HTTP. There isn't really a different protocol here. It sounds more like you want to disable logging for certain request URLs, perhaps. You can do that by writing a suitable log method, eg: class SiteWithoutXMLRPCLogging(Site): def log(self, request): if request.uri.startswith('/RPC2') and request.method == 'POST': return return Site.log(self, request) It might be nicer if the response was also available, though (particularly since the request isn't logged until the response is generated). Then you could avoid encoding the "/RPC2" string (which often isn't actually used) and do something like an isinstance(resource, XMLRPC). Jean-Paul
participants (4)
-
Don Dwiggins
-
exarkun@twistedmatrix.com
-
hbd666
-
Paul Thomas