SimpleXMLRPCServer -- turning off request log?
Sean DiZazzo
half.italian at gmail.com
Fri Sep 26 00:11:53 EDT 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...
>
> ~Sean
Here's the more pythonic version:
# Fake a file handle with the write method
class NullDevice(object):
def write(self, s):
pass
import sys
sys.stdout = NullDevice()
* http://code.activestate.com/recipes/278731/
Comment 1: attributed to Mr. Lundh
~Sean
More information about the Python-list
mailing list