From c01c852c808970ff649c26a0e52d34b3c2d80b0b Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Mon, 22 Oct 2012 23:40:15 +0000 Subject: Enable custom eventlet.wsgi.server log_format * 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 --- nova/wsgi.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/nova/wsgi.py b/nova/wsgi.py index afb5303e4..0aee50ea7 100644 --- a/nova/wsgi.py +++ b/nova/wsgi.py @@ -32,10 +32,21 @@ import webob.exc 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__) @@ -83,7 +94,8 @@ class Server(object): 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. -- cgit