commit 794020e5bde5c49b154609a5db3b52ace572dbf5 Author: David Fifield david@bamsoftware.com Date: Mon Sep 5 02:41:44 2011 -0400
Redirect stderr to the log file to retain tracebacks. --- connector.py | 2 ++ facilitator.py | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/connector.py b/connector.py index 3d3fabe..d763303 100755 --- a/connector.py +++ b/connector.py @@ -144,6 +144,8 @@ else:
if options.log_filename: options.log_file = open(options.log_filename, "a") + # Send error tracebacks to the log. + sys.stderr = options.log_file else: options.log_file = sys.stdout
diff --git a/facilitator.py b/facilitator.py index 619b8b2..ef0cb48 100755 --- a/facilitator.py +++ b/facilitator.py @@ -347,11 +347,6 @@ for o, a in opts: print >> sys.stderr, u"Can't resolve relay %s: %s" % (repr(a), str(e)) sys.exit(1)
-if options.log_filename: - options.log_file = open(options.log_filename, "a") -else: - options.log_file = sys.stdout - if not options.relay_spec: print >> sys.stderr, """\ The -r option is required. Give it the relay that will be sent to proxies. @@ -373,6 +368,13 @@ else: usage(sys.stderr) sys.exit(1)
+if options.log_filename: + options.log_file = open(options.log_filename, "a") + # Send error tracebacks to the log. + sys.stderr = options.log_file +else: + options.log_file = sys.stdout + addrinfo = socket.getaddrinfo(address[0], address[1], 0, socket.SOCK_STREAM, socket.IPPROTO_TCP)[0]
class Server(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):