]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
autoreload also needs to guarantee that logging is configured.
authorBen Darnell <ben@bendarnell.com>
Sun, 9 Sep 2012 20:23:32 +0000 (13:23 -0700)
committerBen Darnell <ben@bendarnell.com>
Sun, 9 Sep 2012 20:23:32 +0000 (13:23 -0700)
tornado/autoreload.py

index ebd3f8b13c770deb987d999446c9974b23a0ae3a..27ef1d103647ced49baf922196d25dd5f7540cec 100644 (file)
@@ -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