【发布时间】:2018-04-19 15:41:01
【问题描述】:
我的 docker 容器正在运行一个带有 gunicorn 的 django 应用程序。
root@72981b4f355e:/usr/src/app# ps -ef
UID PID PPID C STIME TTY TIME CMDq
root 1 0 0 15:32 ? 00:00:00 /usr/local/bin/python /usr/local/bin/gunicorn MyApp.wsgi:application --bind 0.0.0.0:8000 --workers 3
root 9 1 1 15:32 ? 00:00:02 /usr/local/bin/python /usr/local/bin/gunicorn MyApp.wsgi:application --bind 0.0.0.0:8000 --workers 3
root 11 1 1 15:32 ? 00:00:02 /usr/local/bin/python /usr/local/bin/gunicorn MyApp.wsgi:application --bind 0.0.0.0:8000 --workers 3
root 12 1 1 15:32 ? 00:00:02 /usr/local/bin/python /usr/local/bin/gunicorn MyApp.wsgi:application --bind 0.0.0.0:8000 --workers 3
root 21 0 0 15:35 ? 00:00:00 bash
root 28 21 0 15:35 ? 00:00:00 ps -ef
日志什么也不显示,因为工人(产生日志的人)不是 PID1。
如何查看工作人员的日志? Gunicorn 启动如下:
exec gunicorn MyApp.wsgi:application \
--bind 0.0.0.0:8000 \
--workers 3
【问题讨论】:
标签: python docker logging gunicorn