Discussion:
Question on how to supress console logging from BaseHTTPServer Module?
Michael Ströder
2001-05-24 13:48:37 UTC
Permalink
self.log_request(code)
which I can comment out to get rid of the console output. This seems a
bit crude. Is there a better way to suppress the logging output?
Override method log_request() and redirect to log files. Believe me,
you will need the log output.

Ciao, Michael.
David Lees
2001-05-25 17:50:33 UTC
Permalink
Mystery fully solved. Another of my newbie mistakes below.
BaseHTTPRequestHandler is in the BaseHTTPServer module, which means the
reference to BaseHTTPRequestHandler needs to be qualified with the
BaseHTTPServer name when use.

Thanks Alex and Michael.

David Lees
Thanks, this works great. I am an OO newbie or I would have immediately
pass
One minor thing, I still had to go to the BaseHTTPServer.py module and
add the subclassing, rather than having it in my program code. Clearly
there is something really basic about namespace that I am missing. Any
idea what the problem is?
David Lees
Probably the best way is to subclass BaseHTTPServer and overwrite the
log_request method. Something like
def log_request(self, code): pass
HTH
Alex.
Alex
2001-05-24 01:53:36 UTC
Permalink
Probably the best way is to subclass BaseHTTPServer and overwrite the
log_request method. Something like

class quietHTTPServer(BaseHTTPServer):

def log_request(self, code): pass

HTH
Alex.
Emile van Sebille
2001-05-24 13:49:27 UTC
Permalink
from BaseHTTPServer import BaseHTTPRequestHandler
def send_response(self, code, message=None):
pass

Perhaps you did an import instead of a from...import...?

--

Emile van Sebille
emile at fenx.com

---------
"David Lees" <DavidLNoSpammy at raqia.com> wrote in message
Thanks, this works great. I am an OO newbie or I would have immediately
pass
One minor thing, I still had to go to the BaseHTTPServer.py module and
add the subclassing, rather than having it in my program code. Clearly
there is something really basic about namespace that I am missing. Any
idea what the problem is?
David Lees
Probably the best way is to subclass BaseHTTPServer and overwrite the
log_request method. Something like
def log_request(self, code): pass
HTH
Alex.
David Lees
2001-05-24 13:30:34 UTC
Permalink
Thanks, this works great. I am an OO newbie or I would have immediately
done this. I added:

class QuietBaseHTTPRequestHandler(BaseHTTPRequestHandler):
def send_response(self, code, message=None):
pass


One minor thing, I still had to go to the BaseHTTPServer.py module and
add the subclassing, rather than having it in my program code. Clearly
there is something really basic about namespace that I am missing. Any
idea what the problem is?

David Lees
Probably the best way is to subclass BaseHTTPServer and overwrite the
log_request method. Something like
def log_request(self, code): pass
HTH
Alex.
Alex
2001-05-24 17:06:02 UTC
Permalink
One minor thing, I still had to go to the BaseHTTPServer.py module and
add the subclassing, rather than having it in my program code.
Sorry, that was carelessness on my part; I thought the class was called
BaseHTTPServer. If you just import BaseHTTPRequestHandler from
BaseHTTPServer as Emille has suggested and subclass that, you should be
fine.

Alex.

David Lees
2001-05-24 01:27:20 UTC
Permalink
I am using the BaseHTTPServer Module to handle HTTP PUT request. I keep
getting logging information on the console of the machine running my
server every time I use a send_response method. I traced this down to
the send_response method in the baseHTTPServer.py which has a line:

self.log_request(code)

which I can comment out to get rid of the console output. This seems a
bit crude. Is there a better way to suppress the logging output?

David Lees
Loading...