Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2013-02-01 05:29:39 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2013-02-01 05:29:39 (GMT)
commitbb4d97404f1f8358f7e6a1a766a8aa503d26b83e (patch)
tree9cfed5a64e623b0b49268057590141885bbf072f
parent1fbbf8bd342c6c7bfaf2ea1a8f6bfad867bb8419 (diff)
Improve logging from wsgi serveractive_document-production.merged
-rw-r--r--active_toolkit/coroutine.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/active_toolkit/coroutine.py b/active_toolkit/coroutine.py
index 3d7492c..ef76c33 100644
--- a/active_toolkit/coroutine.py
+++ b/active_toolkit/coroutine.py
@@ -44,6 +44,7 @@ gevent.hub.Hub.resolver_class = ['gevent.socket.BlockingResolver']
_group = gevent.pool.Group()
_logger = logging.getLogger('coroutine')
+_wsgi_logger = logging.getLogger('wsgi')
def spawn(callback, *args):
@@ -86,13 +87,15 @@ def WSGIServer(*args, **kwargs):
class WSGIHandler(gevent.wsgi.WSGIHandler):
def log_error(self, msg, *args):
- _logger.error(msg, *args)
+ _wsgi_logger.error(msg, *args)
def log_request(self):
- pass
+ _wsgi_logger.debug('%s', self.format_request())
kwargs['spawn'] = spawn
if 'handler_class' not in kwargs:
+ if logging.getLogger().level >= logging.DEBUG:
+ WSGIHandler.log_request = lambda * args: None
kwargs['handler_class'] = WSGIHandler
return gevent.wsgi.WSGIServer(*args, **kwargs)