On 05/13/2011 05:03 PM, Alan Gauld wrote:
How do you know they are going to stdout? Are you sure
they aren't going to stderr and stderrr is not mapped to stdout
(usually the default). Have you tried redirecting stderr to a
file for example?

As I say, just some thoughts,


Thanks for your thoughts, Alan. I had done some testing with cmdline redirects and forget which is was, I think my debug log was going to stdout and the apache-style log was going to stderr, or the other way around...

After a handful of guys in the #python IRC channel very nearly convinced me that all but 3 stdlib libraries are utter worthless crap, and telling me to download and use third-party frameworks just to fix a simple logging issue, I overrode log_request() and log message() as such:

class clientThread(BaseHTTPRequestHandler): #[[[

        def log_request(code, size):
                return

        def log_message(self, format, *args):
                open(LOGFILE, "a").write("%s\n" % (format%args))


... and now the only logging going on is my own, and it's logged to my external file. Overriding log_request means that BaseHTTPServer no longer outputs its apache-style log, and overriding log_message means my other logging.info() and logging.debug() messages go out to my file as expected.

-id

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to