diff --git a/requestlogger/__init__.py b/requestlogger/__init__.py index 1d5e622..f2671db 100755 --- a/requestlogger/__init__.py +++ b/requestlogger/__init__.py @@ -99,6 +99,12 @@ def format_NCSA_log(status_code, environ, content_length): # see http://docs.python.org/3/library/string.html#format-string-syntax FORMAT = '{host} {logname} {user} [{time}] "{request}" ' FORMAT += '{status} {size} "{referer}" "{agent}"' + + # make this module work nicely together with wsgi-request-id + val['request_id'] = environ.get('REQUEST_ID', None) + if val['request_id'] is not None: + FORMAT += ' {request_id} ' + return FORMAT.format(**val) @staticmethod diff --git a/setup.py b/setup.py index 38111dc..8c25de4 100755 --- a/setup.py +++ b/setup.py @@ -14,34 +14,34 @@ except (IOError, ImportError): LDESC = '' -setup(name='wsgi-request-logger', - version = '0.4.5', - description = 'Apache-like combined logging for WSGI Web Applications', - long_description = LDESC, - author = 'Philipp Klaus', - author_email = 'philipp.l.klaus@web.de', - url = 'https://github.com/pklaus/wsgi-request-logger', - license = 'BSD', - packages = ['requestlogger'], - zip_safe = True, - platforms = 'any', - keywords = 'WSGI Apache-like request logging', - classifiers = [ - 'Development Status :: 4 - Beta', - 'Operating System :: OS Independent', - 'License :: OSI Approved :: BSD License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', - 'Environment :: Web Environment', - 'License :: OSI Approved :: BSD License', - 'Topic :: System :: Monitoring', - 'Topic :: System :: Logging', - 'Topic :: Internet :: WWW/HTTP :: Site Management', - 'Topic :: Internet :: WWW/HTTP :: WSGI', - 'Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware', - ] -) - +setup( + name='wsgi-request-logger', + version='0.4.5', + description='Apache-like combined logging for WSGI Web Applications', + long_description=LDESC, + author='Philipp Klaus', + author_email='philipp.l.klaus@web.de', + url='https://github.com/pklaus/wsgi-request-logger', + license='BSD', + packages=['requestlogger'], + zip_safe=True, + platforms='any', + keywords='WSGI Apache-like request logging', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Operating System :: OS Independent', + 'License :: OSI Approved :: BSD License', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.6', + 'Environment :: Web Environment', + 'License :: OSI Approved :: BSD License', + 'Topic :: System :: Monitoring', + 'Topic :: System :: Logging', + 'Topic :: Internet :: WWW/HTTP :: Site Management', + 'Topic :: Internet :: WWW/HTTP :: WSGI', + 'Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware', + ] + )