plone / plone.recipe.zope2instance

zc.buildout recipe to setup and configure a Zope 2 instance.
https://pypi.org/project/plone.recipe.zope2instance
6 stars 23 forks source link

Invalid access log formatting with the generated WSGI logging config #88

Closed dataflake closed 5 years ago

dataflake commented 5 years ago

The generated wsgi.ini has just one generic formatter for both the event and access logs. It is unsuitable for the access log because it tacks fields to the front.

Zope's own mkwsgiinstance has a second formatter for this purpose, and you should do the same:

[formatters]
keys = generic, message

[formatter_generic]
format = %(asctime)s %(levelname)s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
datefmt = %Y-%m-%d %H:%M:%S

[formatter_message]
format = %(message)s

<...>

[logger_wsgi]
level = WARN
handlers = accesslog
qualname = wsgi
propagate = 0

<...>

[handler_accesslog]
class = FileHandler
args = ('/path/to/log','a')
level = INFO
formatter = message