-
-
Notifications
You must be signed in to change notification settings - Fork 24
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 request-id to logs without using LoggerAdapter #19
Comments
I'm glad you like it! For sure you can do it but I don't think there's anything I need to add in order to make it work. But lets crack it together. Could you please give me an example? What 3rd party lib? |
log_request_id.py
logging inside api :
|
Hey guys. I took my time because I struggled to set it up myself. Uvicorn + Gunicorn + Starlette logging setup is complicated beyond any expectations. And it's very, very buggy, depending on the version of each of these. There are quite a few tickets related to logging. Most often uvicorn does something weird and you just need to make it work together. I see that you have your own, custom logger. If we were to add filters to this project, I'd rather use a generic approach.
or from config
But none of these approaches work for me. Around the time when you asked this question, those tickets were closed encode/uvicorn#512 What I wish was closed is this If you have a working example, I will be happy to accept a contribution. |
I added a working example with:
https://starlette-context.readthedocs.io/en/latest/example.html |
Thank you for this middleware!
I want to use it for adding request IDs in the logs of third-party libraries that I do not have control over. Since most libraries might use a logger instead of LoggerAdapter, I am wondering if there is a way to log request IDs without the use LoggerAdapter(like in the example given in this repo).
The text was updated successfully, but these errors were encountered: