##// END OF EJS Templates
use tornado logging in NotebookApp...
MinRK -
Show More
@@ -1,23 +1,11 b''
1 # coding: utf-8
1 # coding: utf-8
2 """A tornado based IPython notebook server.
2 """A tornado based IPython notebook server."""
3
3
4 Authors:
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
5
6
6 * Brian Granger
7 """
8 from __future__ import print_function
7 from __future__ import print_function
9 #-----------------------------------------------------------------------------
10 # Copyright (C) 2013 The IPython Development Team
11 #
12 # Distributed under the terms of the BSD License. The full license is in
13 # the file COPYING, distributed as part of this software.
14 #-----------------------------------------------------------------------------
15
16 #-----------------------------------------------------------------------------
17 # Imports
18 #-----------------------------------------------------------------------------
19
8
20 # stdlib
21 import errno
9 import errno
22 import io
10 import io
23 import json
11 import json
@@ -33,7 +21,6 b' import time'
33 import webbrowser
21 import webbrowser
34
22
35
23
36 # Third party
37 # check for pyzmq 2.1.11
24 # check for pyzmq 2.1.11
38 from IPython.utils.zmqrelated import check_for_zmq
25 from IPython.utils.zmqrelated import check_for_zmq
39 check_for_zmq('2.1.11', 'IPython.html')
26 check_for_zmq('2.1.11', 'IPython.html')
@@ -60,8 +47,8 b' if version_info < (3,1,0):'
60
47
61 from tornado import httpserver
48 from tornado import httpserver
62 from tornado import web
49 from tornado import web
50 from tornado.log import LogFormatter
63
51
64 # Our own libraries
65 from IPython.html import DEFAULT_STATIC_FILES_PATH
52 from IPython.html import DEFAULT_STATIC_FILES_PATH
66 from .base.handlers import Template404
53 from .base.handlers import Template404
67 from .log import log_request
54 from .log import log_request
@@ -321,13 +308,19 b' class NotebookApp(BaseIPythonApplication):'
321 )
308 )
322
309
323 kernel_argv = List(Unicode)
310 kernel_argv = List(Unicode)
311
312 _log_formatter_cls = LogFormatter
324
313
325 def _log_level_default(self):
314 def _log_level_default(self):
326 return logging.INFO
315 return logging.INFO
327
316
317 def _log_datefmt_default(self):
318 """Exclude date from default date format"""
319 return "%H:%M:%S"
320
328 def _log_format_default(self):
321 def _log_format_default(self):
329 """override default log format to include time"""
322 """override default log format to include time"""
330 return u"%(asctime)s.%(msecs).03d [%(name)s]%(highlevel)s %(message)s"
323 return u"%(color)s[%(levelname)1.1s %(asctime)s.%(msecs).03d %(name)s]%(end_color)s %(message)s"
331
324
332 # create requested profiles by default, if they don't exist:
325 # create requested profiles by default, if they don't exist:
333 auto_create = Bool(True)
326 auto_create = Bool(True)
@@ -596,10 +589,10 b' class NotebookApp(BaseIPythonApplication):'
596 self.log.propagate = False
589 self.log.propagate = False
597
590
598 # hook up tornado 3's loggers to our app handlers
591 # hook up tornado 3's loggers to our app handlers
599 for name in ('access', 'application', 'general'):
592 logger = logging.getLogger('tornado')
600 logger = logging.getLogger('tornado.%s' % name)
593 logger.propagate = True
601 logger.parent = self.log
594 logger.parent = self.log
602 logger.setLevel(self.log.level)
595 logger.setLevel(self.log.level)
603
596
604 def init_webapp(self):
597 def init_webapp(self):
605 """initialize tornado webapp and httpserver"""
598 """initialize tornado webapp and httpserver"""
General Comments 0
You need to be logged in to leave comments. Login now