Skip to content

Commit

Permalink
autoreload also needs to guarantee that logging is configured.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdarnell committed Sep 9, 2012
1 parent 1bc087c commit 2bc828b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tornado/autoreload.py
Expand Up @@ -67,6 +67,7 @@
del sys.path[0]

import functools
import logging
import os
import pkgutil
import sys
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2bc828b

Please sign in to comment.