def main(argv=None): init_options() tornado.options.parse_command_line(argv) try: from tornado.curl_httpclient import curl_log except ImportError as e: log.app_log.warning("Failed to import curl: %s", e) else: # debug-level curl_log logs all headers, info for upstream requests, # which is just too much. curl_log.setLevel(max(log.app_log.getEffectiveLevel(), logging.INFO)) # create and start the app nbviewer = NBViewer() app = nbviewer.tornado_application # load ssl options ssl_options = None if options.sslcert: ssl_options = { 'certfile': options.sslcert, 'keyfile': options.sslkey, } http_server = httpserver.HTTPServer(app, xheaders=True, ssl_options=ssl_options) log.app_log.info("Listening on %s:%i, path %s", options.host, options.port, app.settings['base_url']) http_server.listen(options.port, options.host) ioloop.IOLoop.current().start()
def main(argv=None): init_options() tornado.options.parse_command_line(argv) try: from tornado.curl_httpclient import curl_log except ImportError as e: log.app_log.warning("Failed to import curl: %s", e) else: # debug-level curl_log logs all headers, info for upstream requests, # which is just too much. curl_log.setLevel(max(log.app_log.getEffectiveLevel(), logging.INFO)) # create and start the app app = make_app() # load ssl options ssl_options = None if options.sslcert: ssl_options = { 'certfile' : options.sslcert, 'keyfile' : options.sslkey, } http_server = httpserver.HTTPServer(app, xheaders=True, ssl_options=ssl_options) log.app_log.info("Listening on %s:%i, path %s", options.host, options.port, app.settings['base_url']) http_server.listen(options.port, options.host) ioloop.IOLoop.current().start()
def init_logging(self): # Note that we inherit a self.log attribute from traitlets.config.Application # https://github.com/ipython/traitlets/blob/master/traitlets/config/application.py#L209 # as well as a log_level attribute # https://github.com/ipython/traitlets/blob/master/traitlets/config/application.py#L177 # This prevents double log messages because tornado use a root logger that # self.log is a child of. The logging module dispatches log messages to a log # and all of its ancestors until propagate is set to False. self.log.propagate = False tornado_log = logging.getLogger("tornado") # hook up tornado's loggers to our app handlers for log in (app_log, access_log, tornado_log, curl_log): # ensure all log statements identify the application they come from log.name = self.log.name log.parent = self.log log.propagate = True log.setLevel(self.log_level) # disable curl debug, which logs all headers, info for upstream requests, which is TOO MUCH curl_log.setLevel(max(self.log_level, logging.INFO))
def __init__(self): # don't show GET xxx from tornado.curl_httpclient import curl_log curl_log.setLevel(logging.INFO) self.proxies = []
def __init__(self): # don't show GET xxx if pycurl: from tornado.curl_httpclient import curl_log curl_log.setLevel(logging.INFO)