add possibility to add the request PID to the access logs.

This commit is contained in:
benoitc 2012-02-25 12:18:33 +01:00
parent c7a0af5d3a
commit 125d9f1551
2 changed files with 5 additions and 3 deletions

View File

@ -678,7 +678,7 @@ class AccessLogFormat(Setting):
cli = ["--access-logformat"] cli = ["--access-logformat"]
meta = "STRING" meta = "STRING"
validator = validate_string validator = validate_string
default = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"' default = "%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
desc = """\ desc = """\
The Access log format . The Access log format .
@ -697,7 +697,8 @@ class AccessLogFormat(Setting):
f: referer f: referer
a: user agent a: user agent
T: request time in seconds T: request time in seconds
D: request time in microseconds D: request time in microseconds,
p: process ID
You can also pass any WSGI request header as a parameter. You can also pass any WSGI request header as a parameter.
(ex '%(HTTP_HOST)s'). (ex '%(HTTP_HOST)s').

View File

@ -150,7 +150,8 @@ class Logger(object):
'f': environ.get('HTTP_REFERER', '-'), 'f': environ.get('HTTP_REFERER', '-'),
'a': environ.get('HTTP_USER_AGENT', '-'), 'a': environ.get('HTTP_USER_AGENT', '-'),
'T': str(request_time.seconds), 'T': str(request_time.seconds),
'D': str(request_time.microseconds) 'D': str(request_time.microseconds),
'p': "<%s>" % os.getpid()
} }
# add WSGI request headers # add WSGI request headers