Merge lp:~jaypipes/glance/bug736789 into lp:~glance-coresec/glance/cactus-trunk

Proposed by Jay Pipes
Status: Merged
Approved by: Jay Pipes
Approved revision: 97
Merged at revision: 95
Proposed branch: lp:~jaypipes/glance/bug736789
Merge into: lp:~glance-coresec/glance/cactus-trunk
Prerequisite: lp:~jaypipes/glance/bug731304
Diff against target: 32 lines (+14/-1)
1 file modified
glance/common/wsgi.py (+14/-1)
To merge this branch: bzr merge lp:~jaypipes/glance/bug736789
Reviewer Review Type Date Requested Status
Rick Harris (community) Approve
Andrey Brindeyev (community) Approve
Devin Carlen (community) Approve
Review via email: mp+54127@code.launchpad.net

This proposal supersedes a proposal from 2011-03-18.

Description of the change

Start eventlet WSGI server with a logger to avoid stdout output.

Resubmitted to depend on the lp:~jaypipes/glance/bug731304 branch and not the lp:~jaypipes/glance/bug736295 branch, since lp:~jaypipes/glance/bug731304 contains all those fixes for bug736295.

To post a comment you must log in.
Revision history for this message
Devin Carlen (devcamcar) wrote : Posted in a previous version of this proposal

lgtm

review: Approve
Revision history for this message
Andrey Brindeyev (abrindeyev) wrote : Posted in a previous version of this proposal

lgtm

review: Approve
Revision history for this message
Devin Carlen (devcamcar) wrote :

I don't see any difference between this and the previous proposal, so still lgtm :)

review: Approve
Revision history for this message
Andrey Brindeyev (abrindeyev) wrote :

the same, lgtm

review: Approve
Revision history for this message
Jay Pipes (jaypipes) wrote :

Yeah, sorry, I rebased it on a different branch with one more bug fix in it :)

Revision history for this message
Rick Harris (rconradharris) wrote :

Nice, thanks Jay.

review: Approve
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

The prerequisite lp:~jaypipes/glance/bug731304 has not yet been merged into lp:glance.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'glance/common/wsgi.py'
2--- glance/common/wsgi.py 2011-02-03 15:23:48 +0000
3+++ glance/common/wsgi.py 2011-03-20 15:34:29 +0000
4@@ -35,6 +35,17 @@
5 import webob.exc
6
7
8+class WritableLogger(object):
9+ """A thin wrapper that responds to `write` and logs."""
10+
11+ def __init__(self, logger, level=logging.DEBUG):
12+ self.logger = logger
13+ self.level = level
14+
15+ def write(self, msg):
16+ self.logger.log(self.level, msg.strip("\n"))
17+
18+
19 def run_server(application, port):
20 """Run a WSGI server with the given application."""
21 sock = eventlet.listen(('0.0.0.0', port))
22@@ -61,7 +72,9 @@
23
24 def _run(self, application, socket):
25 """Start a WSGI server in a new green thread."""
26- eventlet.wsgi.server(socket, application, custom_pool=self.pool)
27+ logger = logging.getLogger('eventlet.wsgi.server')
28+ eventlet.wsgi.server(socket, application, custom_pool=self.pool,
29+ log=WritableLogger(logger))
30
31
32 class Middleware(object):

Subscribers

People subscribed via source and target branches