mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-17 15:03:02 +00:00
Merge pull request #1416 from minrk/traitlets-log
avoid error if another traitlets Application is initialized
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user