Merge pull request #1416 from minrk/traitlets-log

avoid error if another traitlets Application is initialized
This commit is contained in:
Carol Willing
2017-09-14 10:50:52 -07:00
committed by GitHub

View File

@@ -12,9 +12,16 @@ config = context.config
# Interpret the config file for Python logging. # Interpret the config file for Python logging.
# This line sets up loggers basically. # This line sets up loggers basically.
if 'jupyterhub' in sys.modules: if 'jupyterhub' in sys.modules:
from traitlets.config import MultipleInstanceError
from jupyterhub.app import JupyterHub from jupyterhub.app import JupyterHub
app = None
if JupyterHub.initialized(): if JupyterHub.initialized():
app = JupyterHub.instance() try:
app = JupyterHub.instance()
except MultipleInstanceError:
# could have been another Application
pass
if app is not None:
alembic_logger = logging.getLogger('alembic') alembic_logger = logging.getLogger('alembic')
alembic_logger.propagate = True alembic_logger.propagate = True
alembic_logger.parent = app.log alembic_logger.parent = app.log