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
After asgi-correlation-id is used, the log cannot be printed when creating fastapi app #23
Comments
Hi! This is probably a question you should ask over at I'll close this issue, but we'll still get notified if you reply in it. Have a good weekend 😊 |
Thank you for your answer. And according to your picture, why is there no correlation id in the start app output log |
The correlation ID is generated when a request is done to FastAPI, and then that ID attached to all other log messages for that request. In other words, if there is just a normal log that is not triggered through a request, it won’t have a correlation ID. Using loguru it seems to be completely gone, normally it would be |
OK, I probably understand what you mean. This may be the problem of loguru. If you use python logging, even normal log can be printed success. Is that right? |
I mean, the ID is generated on an incoming request. So any log generated on startup/shutdown is not triggered by an incoming request, and won’t have an ID. |
I see. Thank you very much for your reply. Have a nice weekend |
You’re welcome. Thank you, you too!😊 |
I configured loguru in fastapi according to the example, and the code is as follows.
After the project is started, logger did not print the log in
start_app()
, justprint()
How can I configure it to print the log correctly when fastapi, startup or adding middleware
The text was updated successfully, but these errors were encountered: