mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-17 15:03:02 +00:00
avoid KeyError in logging with IPython 2
This commit is contained in:
@@ -175,6 +175,13 @@ class JupyterHubApp(Application):
|
||||
"""override default log format to include time"""
|
||||
return u"%(color)s[%(levelname)1.1s %(asctime)s.%(msecs).03d %(name)s]%(end_color)s %(message)s"
|
||||
|
||||
def _log_format_changed(self, name, old, new):
|
||||
"""Change the log formatter when log_format is set."""
|
||||
# FIXME: IPython < 3 compat
|
||||
_log_handler = self.log.handlers[0]
|
||||
_log_formatter = self._log_formatter_cls(fmt=new, datefmt=self.log_datefmt)
|
||||
_log_handler.setFormatter(_log_formatter)
|
||||
|
||||
def init_logging(self):
|
||||
# This prevents double log messages because tornado use a root logger that
|
||||
# self.log is a child of. The logging module dipatches log messages to a log
|
||||
@@ -186,7 +193,7 @@ class JupyterHubApp(Application):
|
||||
logger.propagate = True
|
||||
logger.parent = self.log
|
||||
logger.setLevel(self.log.level)
|
||||
# IPython < 3 compat
|
||||
# FIXME: IPython < 3 compat
|
||||
self._log_format_changed('', '', self.log_format)
|
||||
|
||||
def init_ports(self):
|
||||
|
Reference in New Issue
Block a user