Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logging with WSGI #526

Closed
georgpfolz opened this issue Mar 8, 2019 · 3 comments

Comments

@georgpfolz
Copy link

commented Mar 8, 2019

Zope 4 deploys by default with the waitress WSGI server. Out of the box, no log files are created when running such an instance. It would be helpful to have logging preconfigured (in the zope.ini I guess) in a similar way than with ZServer.

@pbauer

This comment has been minimized.

Copy link
Contributor

commented Mar 8, 2019

@pbauer pbauer closed this Mar 8, 2019

@georgpfolz

This comment has been minimized.

Copy link
Author

commented Mar 9, 2019

I don't use Plone nor zc.buildout so it's not a fix for me. But it was helpful as I could glean enough information to build my own zope.ini:

[app:zope]
use = egg:Zope#main
zope_conf = %(here)s/wsgi.conf

[server:main]
use = egg:waitress#main
host = 127.0.0.1
port = 8080

[filter:translogger]
use = egg:Paste#translogger
setup_console_handler = False

[pipeline:main]
pipeline =
    egg:Zope#httpexceptions
    translogger
    zope

[loggers]
keys = root, waitress, wsgi

[handlers]
keys = console, accesslog, eventlog

[formatters]
keys = generic, message

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

[formatter_message]
format = %(message)s

[logger_root]
level = INFO
handlers = console

[logger_waitress]
level = INFO
handlers = eventlog
qualname = waitress

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

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[handler_accesslog]
class = FileHandler
args = ('%(here)s/../log/Z4.log','a')
level = INFO
formatter = message

[handler_eventlog]
class = FileHandler
args = ('%(here)s/../log/event.log', 'a')
level = INFO
formatter = generic

I'm not sure if it's all correct as I'm not familiar with waitress configuration (but it works). I was hoping the default zope.ini on deployment could be like that.

@icemac icemac reopened this Mar 9, 2019

@icemac

This comment has been minimized.

Copy link
Member

commented Mar 12, 2019

I see a value in having a default logging configuration when creating a Zope instance using bin/mkwsgiinstance.

@icemac icemac added this to To do in Zope 4 final release via automation Mar 12, 2019

@icemac icemac added this to the 4.0 final milestone Mar 12, 2019

@dataflake dataflake closed this in 647180d Apr 10, 2019

Zope 4 final release automation moved this from To do to Done Apr 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
3 participants
You can’t perform that action at this time.