-
-
Notifications
You must be signed in to change notification settings - Fork 606
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
How to get the container's logs? #6
Comments
@aleonchen all the logs are redirected to docker logs <your container>
docker logs --tail=50 <your container>
docker logs -f <your container> |
@tiangolo But it could only show the flask logging info. How could I get the nginx logging? For example the access.log or error.log |
The thing is, you should be already getting those logs. For example, if you try requesting something inside
That log would be from Nginx. As Flask doesn't even get the request. Nginx reads it and sees that you are asking for something under But if you are running any docker run -it myimage python /app/main.py That is useful for developing and / or debugging, but for "production", or when you want to test the Supervisord / Nginx / uWSGI functionality that this image provides, you should remove those |
OK, I got what you say, but I found that when I run the docker for some time. The flask web service will hung up, and I could not found what the issue is. For example
Step 2 I use the
Step 3 |
Well, the first thing, the trick of the If Nginx was not being able to communicate with uWSGI (Flask) it would report it, with something saying that it couldn't connect to the socket or something similar. I can't help you debug it if you only post the idea you have of the log. You need to copy the real log for me to be able to try to help you. When you get the error, copy a big chunk of the log. With what you have provided I can't really check anything. Also, let me suggest you to use Sentry. You can create a free account or deploy yourself the opensource version with Docker. That will help you a lot detecting problems in your code. |
@tiangolo After some digging I found the problem. When I use Then I check the Dockerfile and found the issue.
I shoud remove the last two lines. Thanks a lot for your patient. But now my question is if I do not use |
I'm glad you were able to solve your issue! The best way is to Your "state" shouldn't be in that container anyway, it should be in a database in another container. Or at least, in a volume, like a named volume. Then, I will now close this issue. |
Hi tiangolo
Great thanks for your dockers, I could setup a simple web app with flask.
I found when the app kept running somethings, it will hang up.
When I connect the running container's bash, I could only get the flask logs on the bash.
But could not get the nginx logging.
Do you have any advice for it?
Thank you
The text was updated successfully, but these errors were encountered: