Python XMLRPC question

Falcolas garrickp at gmail.com
Tue Oct 13 21:55:09 CEST 2009


On Oct 13, 12:47 pm, prasanna <prasa... at ix.netcom.com> wrote:
> In using Python's XMLRPC, there is a statement that gets printed on
> stdout of the form:
>                  localhost - - [12/Oct/2009 23:36:12] "POST /RPC2 HTTP/
> 1.0" 200 -
>
> Where does this message originate? Can I turn it off, or at least
> redirect it into a logging file? I am planning to run the server code
> automatically at start up and wouldn't have a terminal window open to
> get this message. I guess I could redirect/pipe it to a file, but it
> would be more useful I could send it to the same log file that I have
> the server writing other messages to.
>
> Thanks for any help.

Looking back through the SimpleXMLRPCServer code, it appears that this
happens if the logRequests parameter in the SimpleXMLRPCServer class
initialization is set to True, which it is by default. The underlying
implementation of the logging is in BaseHTTPServer.py, which uses
sys.stderr.

Looks like the simplest way to change that would be to inherit from
the SimpleXMLRPCRequestHandler class and implement your own
log_request method. You could then pass that to the SimpleXMLRPCServer
constructor.

Garrick



More information about the Python-list mailing list