SimpleXMLRPCServer - disable output

Jeremy Jones zanesdad at bellsouth.net
Thu Apr 14 18:47:57 EDT 2005


codecraig wrote:

>Jeremy Jones wrote:
>  
>
>>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
>>    
>>
>
>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.
>
>  
>
You've got a couple of options.  You can either set it in the
constructor (server = SimpleXMLRPCServer(addr,
requestHandler=somehandler, logRequests=0)) or you can set it after you
have an instance of it (<<create an instance named foo>>;
foo.logRequests = 0).

HTH,

Jeremy Jones
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20050414/8e0eeb45/attachment.html>


More information about the Python-list mailing list