From c5f137c715dd39c4285237944d16cfcbc4706493 Mon Sep 17 00:00:00 2001 From: zenix Date: Wed, 12 Apr 2017 18:52:01 +0900 Subject: [PATCH] fix original code logic --- sanic/app.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sanic/app.py b/sanic/app.py index 7da1dc41..dbfaba77 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -31,9 +31,9 @@ class Sanic: log_config=DEFAULT_LOG_CONF): if log_config: logging.config.dictConfig(log_config) - else: - # Only set up a default log handler if the - # end-user application didn't set anything up. + # Only set up a default log handler if the + # end-user application didn't set anything up. + if not logging.root.handlers and log.level == logging.NOTSET: formatter = logging.Formatter( "%(asctime)s: %(levelname)s: %(message)s") handler = logging.StreamHandler() @@ -448,6 +448,7 @@ class Sanic: # -------------------------------------------- # # Request Middleware # -------------------------------------------- # + request.app = self response = await self._run_request_middleware(request) # No middleware results