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:30:09 (GMT)
commit410864744471012b5d00449cc02e9ad495e41661 (patch)
tree89df5663c552d38848098586395b2e6c59978759
parent5bbcf94ebec597f335aeb19549b19163d46afce4 (diff)
Improve logging from wsgi serveractive_document-index_queue.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)