SimpleXMLRPCServer -- turning off request log?

M

mh

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
 
S

Sean DiZazzo

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

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
 
S

Sean DiZazzo

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

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
 
V

Vinay Sajip

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 thisloggingoff? I have RTFM and can't
seem to find a way to do so.

From the documentation (2.5):

class SimpleXMLRPCServer( addr[, requestHandler[, logRequests[,
allow_none[, encoding]]]])

"If logRequests is true (the default), requests will be logged;
setting this parameter to false will turn off logging."

Did you try setting logRequests to false?

Regards,

Vinay Sajip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top