SimpleXMLRPCServer -- turning off request log?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mh@pixar.com

    SimpleXMLRPCServer -- turning off request log?

    My SimpleXMLRPCSer ver 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
  • Sean DiZazzo

    #2
    Re: SimpleXMLRPCSer ver -- turning off request log?

    On Sep 25, 6:01 pm, m...@pixar.com wrote:
    My SimpleXMLRPCSer ver 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

    Comment

    • Sean DiZazzo

      #3
      Re: SimpleXMLRPCSer ver -- turning off request log?

      On Sep 25, 9:04 pm, Sean DiZazzo <half.ital...@g mail.comwrote:
      On Sep 25, 6:01 pm, m...@pixar.com wrote:
      >
      My SimpleXMLRPCSer ver 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(obje ct):
      def write(self, s):
      pass

      import sys
      sys.stdout = NullDevice()

      * http://code.activestate.com/recipes/278731/
      Comment 1: attributed to Mr. Lundh

      ~Sean

      Comment

      • Vinay Sajip

        #4
        Re: SimpleXMLRPCSer ver -- turning off request log?

        On Sep 26, 2:01 am, m...@pixar.com wrote:
        My SimpleXMLRPCSer ver 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 SimpleXMLRPCSer ver( 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

        Comment

        • mh@pixar.com

          #5
          Re: SimpleXMLRPCSer ver -- turning off request log?

          Vinay Sajip <vinay_sajip@ya hoo.co.ukwrote:
          Did you try setting logRequests to false?
          Perfect, that's just what I needed.

          Thanks Vinay!!
          Mark

          --
          Mark Harrison
          Pixar Animation Studios

          Comment

          Working...