SimpleXMLRPCServer -- turning off request log?
half.italian at gmail.com
Fri Sep 26 06:11:53 CEST 2008
On Sep 25, 9:04 pm, Sean DiZazzo <half.ital... at gmail.com> wrote:
> On Sep 25, 6:01 pm, m... at pixar.com wrote:
> > My SimpleXMLRPCServer program prints to stderr a line like
> > this for each request:
> > ohm..pixar.com - - [25/Sep/2008 17:57:50] "POST /RPC2 HTTP/1.0" 200 -
> > Is there a way to turn this logging off? I have RTFM and can't
> > seem to find a way to do so.
> > Many TIA!
> > Mark
> > --
> > Mark Harrison
> > Pixar Animation Studios
> Im pretty sure there's a more pythonic way, but you could redirect
> stdout to /dev/null
> import sys
> sys.stdout = open("/dev/null", 'w')
> assuming you're not on windows...
Here's the more pythonic version:
# Fake a file handle with the write method
def write(self, s):
sys.stdout = NullDevice()
Comment 1: attributed to Mr. Lundh
More information about the Python-list