Can I Redirect debug output from HTTPConnection to a file?
3 views
Skip to first unread message
Harel
unread,
Jul 10, 2007, 5:32:04 AM7/10/07
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I'm using httplib.HTTPConnection to perform http connections and during the beta period of the application I wanted to log its verbose output [set_debuglevel(5)]. However, raising the debuglevel just outputs it to stdout. can I redirect that to a file? My app uses the logging module for logging and I'd like to use that to log into the standard log it generates.
Any ideas? Thanks, Harel
Harel
unread,
Jul 10, 2007, 10:21:01 AM7/10/07
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I'll answer myself then:
import os ioLogFile = file(LOG_FILE_PATH + IO_LOG_FILE, "w") #get a log file created os.dup2(config.ioLogFile.fileno(), 1) #route stdout (file descriptor 1) to the log file's one