I just wasted a good chunk of the morning trying to figure out why one of my view methods was getting called at inappropriate times. The short story is that I had written my url mapping wrong so I was accidentally matching requests for /favicon.ico. The debugging was MUCH harder than it should have been because the /favicon.ico requests were not being logged -- I was seeing one request come in, and two view methods called! It wasn't until I pulled out the big guns (i.e. tcpdump), that the pieces fell into place.
Anyway, it seems like a serious mis-feature that BaseHTTPServer.log_message() deliberately suppresses certain requests:
def log_message(self, format, *args):
# Don't bother logging requests for admin images or the favicon.
if self.path.startswith(self.admin_media_prefix) or self.path == '/favicon.ico':
Note the chain of events here: 1) I made a programming mistake, 2) the browser was magically asking for something I hadn't requested, and 3) the sever was magically suppressing the evidence that 2) was happening. It's a prototyping/teaching/debugging tool. It should be very explicit about what it's doing. If logging these things makes the output too verbose, then provide an option somewhere to suppress it, with the default being to log everything.