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

Add LOG_LEVEL env var? #41

Open
SHxKM opened this issue Jan 27, 2024 · 3 comments
Open

Add LOG_LEVEL env var? #41

SHxKM opened this issue Jan 27, 2024 · 3 comments

Comments

@SHxKM
Copy link

SHxKM commented Jan 27, 2024

Really enjoying the quality of this, I was wondering if it'd be handy to have a LOG_LEVEL env var (detached from DEBUG) that would allow Django to output logs when running with gunicorn in production.

@nickjj
Copy link
Owner

nickjj commented Jan 27, 2024

Thanks.

Gunicorn is also used in development. There's a Gunicorn loglevel config option you can add that could be associated with a WEB_LOG_LEVEL env var that we add. Is that what you were thinking? Alternatively there's https://docs.djangoproject.com/en/5.0/topics/logging.

@SHxKM
Copy link
Author

SHxKM commented Jan 27, 2024

Just realized what I was really referring to is having Django log level be controlled by an environment variable.

@nickjj
Copy link
Owner

nickjj commented Jan 28, 2024

Django has different log levels for different components of its framework. For example here's the default logging settings: https://docs.djangoproject.com/en/5.0/ref/logging/#default-logging-configuration

We would have to override those and reference an env variable. Likely the handlers.console and loggers.django sections would be overwritten. The rest can remain hard coded because this project doesn't use the django.server and having admin emails only report errors is a good default for now.

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

2 participants