From 2bc828b5a61736135107b69e9519032d31b49bf6 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sun, 9 Sep 2012 13:23:32 -0700 Subject: [PATCH] autoreload also needs to guarantee that logging is configured. --- tornado/autoreload.py | 4 ++++ 1 file changed, 4 insertions(+) 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 -- 2.47.2