开发者

Silence output from SimpleXMLRPCServer

开发者 https://www.devze.com 2022-12-22 18:02 出处:网络
I am running an xml-rpc server using SimpleXMLRPCServer from the stdlib. My code looks something like this:

I am running an xml-rpc server using SimpleXMLRPCServer from the stdlib.

My code looks something like this:

import SimpleXMLRPCServer
import socket

class RemoteStarter:
    def start(self):
        return 'foo'

rs = RemoteStarter()
host = socket.gethostbyaddr(socket.gethostname())[0]
port = 9000
server = SimpleXMLRPCServer.SimpleXMLRPCServer((host, port))
server.register_instance(rs)
server.serve_fore开发者_运维百科ver()

every time the 'start' method gets called remotely, the server prints an access line like this:

<server_name> - - [10/Mar/2010 13:06:20] "POST /RPC2 HTTP/1.0" 200 -

I can't figure out a way to silence the output so it doesn't print these access lines to stdout.

anyone?


the answer is:

pass logRequests=False to SimpleXMLRPCServer when you create it:

server = SimpleXMLRPCServer.SimpleXMLRPCServer((host, port), logRequests=False)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号