Skip to content

Commit

Permalink
Enable custom eventlet.wsgi.server log_format
Browse files Browse the repository at this point in the history
* The default log format has duplicate info. (datetime etc)
* Reference: http://eventlet.net/doc/modules/wsgi.html
* contains information not shown elsewhere (wall_seconds, body_length)

Change-Id: I57917b62c1f2cc4bba06011191dcf0b5342d7d43
  • Loading branch information
jogo committed Oct 23, 2012
1 parent 16d653a commit c01c852
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions nova/wsgi.py
Expand Up @@ -32,10 +32,21 @@

from nova import exception
from nova import flags
from nova.openstack.common import cfg
from nova.openstack.common import log as logging


wsgi_opts = [
cfg.StrOpt('wsgi_log_format',
default='%(client_ip)s "%(request_line)s" status: %(status_code)s'
' len: %(body_length)s time: %(wall_seconds).7f',
help='A python format string that is used as the template to '
'generate log lines. The following values can be formatted '
'into it: client_ip, date_time, request_line, status_code, '
'body_length, wall_seconds.')
]
FLAGS = flags.FLAGS
FLAGS.register_opts(wsgi_opts)

LOG = logging.getLogger(__name__)


Expand Down Expand Up @@ -83,7 +94,8 @@ def start(self):
self.app,
protocol=self._protocol,
custom_pool=self._pool,
log=self._wsgi_logger)
log=self._wsgi_logger,
log_format=FLAGS.wsgi_log_format)

def stop(self):
"""Stop this server.
Expand Down

0 comments on commit c01c852

Please sign in to comment.