Comments (10)
@victornoel did you find a solution to this? I am getting info logs from uvicorn.access
although I have LOG_LEVEL
set to warning
in gunicorn
.
from uvicorn-gunicorn-docker.
+1
from uvicorn-gunicorn-docker.
@mr-bjerre I ended up configuring a ini config file with this inside (I omitted the other things in it):
[logger_gunicorn]
level=INFO
handlers=console
propagate=0
qualname=gunicorn
[logger_gunicorn_access]
level=WARNING
handlers=console
propagate=0
qualname=gunicorn.access
And I pass it to gunicorn via --log-config
(it means I run gunicorn by hand). I suppose #21 would be helpflu there.
from uvicorn-gunicorn-docker.
You can now set (or disable) the access log with: https://github.com/tiangolo/uvicorn-gunicorn-docker#access_log 🎉
And you can also pass Gunicorn configs in an env var: https://github.com/tiangolo/uvicorn-gunicorn-docker#gunicorn_cmd_args
from uvicorn-gunicorn-docker.
It looks like this works when running gunicorn in start.sh, but is ignored in start-reload.sh. Would be great to get that script to run exec uvicorn --reload --no-access-log
when ACCESS_LOG
is unset.
from uvicorn-gunicorn-docker.
@joshzana start-reload.sh
is exclusively for local development, just as a simple, small, shortcut. You shouldn't use it for production. It will only use a single process and will use a lot more resources (memory, etc) watching files, etc.
But anyway, if for some reason you still need custom logic during development, you can also write a small script using start-reload.sh
as template, and running that.
from uvicorn-gunicorn-docker.
Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.
from uvicorn-gunicorn-docker.
This problem persists for me.
I am running a container. Viewing the stdout/stderr of the container.
I currently have the following gunicorn_conf.py set in my /app/gunicorn_conf.py:
# Gunicorn config variables
loglevel = "info"
workers = 2
threads = 8
bind = "0.0.0.0:80"
preload_app = False
statsd_host = "statsd:8125"
statsd_prefix = "recsys"
timeout = 180
keepalive = 120
accesslog = None
errorlog = "-"
While changing the accesslog parameter to stdout ("-") has gunicorn log. Uvicorn still is logging no matter what I do:
INFO:uvicorn.access:127.0.0.1:36678 - "GET /health/test HTTP/1.1" 200
INFO:uvicorn.access:172.17.0.1:46740 - "GET / HTTP/1.1" 200
INFO:uvicorn.access:172.17.0.1:46744 - "GET / HTTP/1.1" 200
INFO:uvicorn.access:172.17.0.1:46748 - "GET / HTTP/1.1" 200
INFO:uvicorn.access:172.17.0.1:46752 - "GET / HTTP/1.1" 200
INFO:uvicorn.access:172.17.0.1:46756 - "GET / HTTP/1.1" 200
INFO:uvicorn.access:172.17.0.1:46760 - "GET / HTTP/1.1" 200
INFO:uvicorn.access:172.17.0.1:46764 - "GET / HTTP/1.1" 200
INFO:uvicorn.access:172.17.0.1:46768 - "GET / HTTP/1.1" 200
INFO:uvicorn.access:172.17.0.1:46772 - "GET / HTTP/1.1" 200
INFO:uvicorn.access:172.17.0.1:46776 - "GET / HTTP/1.1" 200
INFO:uvicorn.access:172.17.0.1:46780 - "GET / HTTP/1.1" 200
INFO:uvicorn.access:172.17.0.1:46784 - "GET / HTTP/1.1" 200
INFO:uvicorn.access:172.17.0.1:46788 - "GET / HTTP/1.1" 200
Using the ACCESS_LOG parameter (or manually setting it in my gunicorn_conf.py) seems to have absolutely no effect on that log printing out.
I have yet to follow the advice of @victornoel and change out the logging configuration. I am wondering if we have a more direct and clear solution to this problem.
from uvicorn-gunicorn-docker.
Following up on my previous post. If I clear out uvicorns access logger and turn off its propagation it seems to work.
import logging as log
app = ...
...
log.getLogger('uvicorn.access').handlers = []
log.getLogger('uvicorn.access').propagate = False
from uvicorn-gunicorn-docker.
If anyone is still having issues, please try with a recent version of Uvicorn, a previous version was overriding the root logger.
from uvicorn-gunicorn-docker.
Related Issues (20)
- Only prints `log_data` if `LOG_LEVEL` == `DEBUG`
- Custom gunicorn configuration file for logging
- python3.8-slim image: Time not Synced to Local Machine HOT 1
- python 3.10 image HOT 5
- Image for ARM64 chips HOT 4
- Is there a docker image that include both mysql and python? HOT 1
- Feature: Disable access log when using live-reload
- Deploying docker image with Nginx HOT 2
- Upgrade to Python 3.8.8 to fix CVE-2021-3177 HOT 2
- Update PyYAML to >= 5.4 for CVE-2020-14343 HOT 3
- Log message are missing HOT 2
- Python 3.9 HOT 5
- Updated Uvicorn to 0.14.0 to increase ws max_size to > 1mb, but doesn't work, & get "error walking file system: FileNotFoundError [Errno 2] No such file or directory: '/app/.venv/bin/python'" HOT 2
- How to enable all debug which is available?
- Wrong ML prediction inside the docker HOT 1
- Ignore HOT 1
- how gunicorn + uvicorn + uvloop + httptools HOT 1
- RuntimeError: Task attached to a different loop HOT 2
- Images are out of date HOT 4
- New uvicorn[standard] version cause memory leak due to tcp ping HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uvicorn-gunicorn-docker.