开发者

Silence output from SimpleXMLRPCServer

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜