Waitress and logrotation / USR2 signal

32 views
Skip to first unread message

J G

unread,
Mar 26, 2020, 9:29:58 AM3/26/20
to pylons-discuss
Hi,

I am running a Zope app. Since Zope 4 waitress is the default WSGI server (I hope I get the terms right).

Sending `kill -USR2 zope.pid` used to trigger a log close and reopen, but since Zope 4 this shuts the app down.

Does waitress do any signal handling? I could not find anything when scanning the manual.

Looks like nobody takes care of the kill signal and Python terminates the process.

How would I do proper logrotation then?

Thank you!
Jürgen

P.S.: This was posted first at Zope's issue tracker

Bert JW Regeer

unread,
Mar 27, 2020, 1:25:15 AM3/27/20
to Pylons Project
Waitress does not do any logging on its own, and thus doesn't handle any signals related to log rotation as it is not aware of any logs.

You could run the application using a process manager and have the process manager restart the application, or even better have the process manager capture the logs and write them using a separate process rather than having the app do it directly.

--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/e712c317-078a-430c-87d4-2d1f1dde0466%40googlegroups.com.

J G

unread,
Mar 27, 2020, 3:44:28 AM3/27/20
to pylons-discuss
Thank you, Bert!

As a replacement for the missing signal handling of Zope, there seem to be several valid alternatives without the need to restart the application:
- have the process manager capture the logs
- logrotate's `copytruncate` directive
- Python's `WatchedFileHandler`

One problem, three solutions :-)

Mike Orr

unread,
Mar 27, 2020, 1:03:21 PM3/27/20
to pylons-...@googlegroups.com
I sometimes get log entries about worker threads that appear to come
from Waitress. I'll see if I can find the configuration that
suppressed them.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/562B0E96-6CEC-4E00-B454-36E1C1B1E412%400x58.com.



--
Mike Orr <slugg...@gmail.com>

Bert JW Regeer

unread,
Mar 27, 2020, 6:23:00 PM3/27/20
to Pylons Project
Sure, waitress just uses python's logging library to send log messages, but it doesn't know anything about where it's configured to send those. That heavily depends on what your root logger is set to, and you can configure logging for individual waitress parts as necessary too.

But waitress does not do logging of requests for instance, it doesn't set up logging, or anything along those lines.

Bert
> To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/CAH9f%3Duqt8vtphjRAG%3Dx3DaxaFG3VzgfyOO4iSVXO-urpV1pjqA%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages