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

Handling log file rotation #196

Open
BoyanH opened this issue Feb 26, 2024 · 0 comments
Open

Handling log file rotation #196

BoyanH opened this issue Feb 26, 2024 · 0 comments

Comments

@BoyanH
Copy link

BoyanH commented Feb 26, 2024

I am using the logconfig_dict configuration key to log to a file vialogging.FileHandler. Then I'm using logrotate to rotate the log files daily, something similar to:

/var/log/my-app.log {
 daily
 rotate 30
 compress
 dateext
 dateformat .%Y-%m-%d
 notifempty
 sharedscripts
 postrotate
     kill -USR1 $(cat /path-to/my-app.pid)
 endscript
}

Coming from a Flask+Gunicorn setup, I am using kill -USR1 $(cat /path-to/my-app.pid) to signal that the log files have changed and need to be reopened. The /path-to/my-app.pid is configured via pid_path.

Hypercorn isn't handling the signal the way Gunicorn does (or not at all) and the server is simply shut down. How should I go about implementing a similar logic in Hypercorn?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant