From: Ben Darnell Date: Sun, 9 Sep 2012 20:23:32 +0000 (-0700) Subject: autoreload also needs to guarantee that logging is configured. X-Git-Tag: v3.0.0~272^2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bc828b5a61736135107b69e9519032d31b49bf6;p=thirdparty%2Ftornado.git autoreload also needs to guarantee that logging is configured. --- diff --git a/tornado/autoreload.py b/tornado/autoreload.py index ebd3f8b13..27ef1d103 100644 --- a/tornado/autoreload.py +++ b/tornado/autoreload.py @@ -67,6 +67,7 @@ if __name__ == "__main__": del sys.path[0] import functools +import logging import os import pkgutil import sys @@ -272,12 +273,15 @@ def main(): # module) will see the right things. exec f.read() in globals(), globals() except SystemExit, e: + logging.basicConfig() gen_log.info("Script exited with status %s", e.code) except Exception, e: + logging.basicConfig() gen_log.warning("Script exited with uncaught exception", exc_info=True) if isinstance(e, SyntaxError): watch(e.filename) else: + logging.basicConfig() gen_log.info("Script exited normally") # restore sys.argv so subsequent executions will include autoreload sys.argv = original_argv