summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Gordon <jogo@cloudscaling.com>2012-10-22 23:40:15 +0000
committerJoe Gordon <jogo@cloudscaling.com>2012-10-22 17:08:12 -0700
commitc01c852c808970ff649c26a0e52d34b3c2d80b0b (patch)
tree23a8f04ed3689782a410e4dc261382d542bf4351
parent16d653a3067332dc06f5138d2b842a79d65803a6 (diff)
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
-rw-r--r--nova/wsgi.py16
1 files 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.