Python XMLRPC question

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Oct 13 16:22:50 EDT 2009


En Tue, 13 Oct 2009 16:55:09 -0300, Falcolas <garrickp at gmail.com> escribió:

> 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.

I think it's easier to pass logRequests=False when creating the server.

-- 
Gabriel Genellina




More information about the Python-list mailing list