Handling the log in BaseHTTPServer
Tapi
tapi at syskall.net
Wed May 4 11:55:33 EDT 2011
Hi,
You may create a subclass of (or Mixin for) BaseHTTPRequestHandler to
override its log_message() method.
Here's a really simple example ; it's perfectible, but it should show
you the way :
class MyLoggingHTTPRequestHandler(BaseHTTPRequestHandler):
def log_message(self, format, *args):
open(LOGFILE, "a").write("%s - - [%s] %s\n" %
(self.address_string(),
self.log_date_time_string(),
format%args))
httpd = HTTPServer(ADDR, MyLoggingHTTPRequestHandler)
httpd.serve_forever()
Simon
On Wed, 4 May 2011 03:52:29 -0700 (PDT), LehH Sdsk8 wrote:
> First, i'm sorry for any inglish error!
>
> So, i use the BaseHTTPServer to create a page for monitoring
> purposes,
> someone now how to direct the event log to a file?
More information about the Python-list
mailing list