By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,320 Members | 2,239 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,320 IT Pros & Developers. It's quick & easy.

SimpleXMLRPCServer - disable output

P: n/a
Hi,
I thought I posted this, but its been about 10min and hasnt shown up
on the group.
Basically I created a SimpleXMLRPCServer and when one of its methods
gets called and it returns a response to the client, the server prints
some info out to the console, such as,

localhost - - [14/Apr/2005 16:06:28] "POST /RPC2 HTTP/1.0" 200 -

Anyhow, is there a way I can surpress that so its not printed to the
console? I looked at SimpleXMLRPCServer.py ...it doesn't explicitly
print that, I think perhaps std is...but not sure. Any ideas??

thanks.

Jul 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

codecraig> I thought I posted this, but its been about 10min and hasnt
codecraig> shown up on the group.

Patience...

codecraig> localhost - - [14/Apr/2005 16:06:28] "POST /RPC2 HTTP/1.0" 200 -

codecraig> Anyhow, is there a way I can surpress that so its not printed
codecraig> to the console? I looked at SimpleXMLRPCServer.py ...it
codecraig> doesn't explicitly print that, I think perhaps std is...but
codecraig> not sure. Any ideas??

Introspection is your friend:
import SimpleXMLRPCServer
for a in dir(SimpleXMLRPCServer):

... matches = [m for m in dir(getattr(SimpleXMLRPCServer, a))
... if m.find("log") != -1]
... if matches:
... print "***", a, "***"
... print matches
...
*** SimpleXMLRPCRequestHandler ***
['log_date_time_string', 'log_error', 'log_message', 'log_request']
*** os ***
['getlogin']

Skip
Jul 19 '05 #2

P: n/a
codecraig wrote:
Hi,
I thought I posted this, but its been about 10min and hasnt shown up
on the group.
Basically I created a SimpleXMLRPCServer and when one of its methods
gets called and it returns a response to the client, the server prints
some info out to the console, such as,

localhost - - [14/Apr/2005 16:06:28] "POST /RPC2 HTTP/1.0" 200 -

Anyhow, is there a way I can surpress that so its not printed to the
console? I looked at SimpleXMLRPCServer.py ...it doesn't explicitly
print that, I think perhaps std is...but not sure. Any ideas??

thanks.

Here's the entire SimpleMLRPCServer class from SimpleXMLRPCServer.py:
class SimpleXMLRPCServer(SocketServer.TCPServer,
SimpleXMLRPCDispatcher):
"""Simple XML-RPC server.

Simple XML-RPC server that allows functions and a single instance
to be installed to handle requests. The default implementation
attempts to dispatch XML-RPC calls to the functions or instance
installed in the server. Override the _dispatch method inhereted
from SimpleXMLRPCDispatcher to change this behavior.
"""

def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler,
logRequests=1):
self.logRequests = logRequests

SimpleXMLRPCDispatcher.__init__(self)
SocketServer.TCPServer.__init__(self, addr, requestHandler)

You should be able to change logRequests to 0 and that should fix it. I just tested it at a prompt and it worked just fine.
Jeremy Jones

Jul 19 '05 #3

P: n/a

Jeremy Jones wrote:
codecraig wrote:
Hi,
I thought I posted this, but its been about 10min and hasnt shown upon the group.
Basically I created a SimpleXMLRPCServer and when one of its methodsgets called and it returns a response to the client, the server printssome info out to the console, such as,

localhost - - [14/Apr/2005 16:06:28] "POST /RPC2 HTTP/1.0" 200 -

Anyhow, is there a way I can surpress that so its not printed to the
console? I looked at SimpleXMLRPCServer.py ...it doesn't explicitly
print that, I think perhaps std is...but not sure. Any ideas??

thanks.
Here's the entire SimpleMLRPCServer class from SimpleXMLRPCServer.py:
class SimpleXMLRPCServer(SocketServer.TCPServer,
SimpleXMLRPCDispatcher):
"""Simple XML-RPC server.

Simple XML-RPC server that allows functions and a single instance
to be installed to handle requests. The default implementation
attempts to dispatch XML-RPC calls to the functions or instance
installed in the server. Override the _dispatch method inhereted
from SimpleXMLRPCDispatcher to change this behavior.
"""

def __init__(self, addr,

requestHandler=SimpleXMLRPCRequestHandler, logRequests=1):
self.logRequests = logRequests

SimpleXMLRPCDispatcher.__init__(self)
SocketServer.TCPServer.__init__(self, addr, requestHandler)

You should be able to change logRequests to 0 and that should fix it. I just tested it at a prompt and it worked just fine.

Jeremy Jones


Jeremy,
So can you explain what I can do to set logRequests = 0? Do i just
do..

server = SimpleXMLRPCServer(0) ???

I am sorta new to python thanks.

Jul 19 '05 #4

P: n/a
Jeremy,
Thanks for clearing that up. I am so used to java (i.e.
foo.setLogRequests(0))...that I forgot I could just do, foo.logRequests
= 0.

Learning one day at a time :)

Thanks.

Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.