我正在使用超级用户在容器内运行django应用程序。
但是有时我需要查看日志以修复某些错误,而我找不到解决方法。
我尝试添加stdout_logfile
和stderr_logfile
,但错误日志文件始终为空
这是我的supervisor.conf
[supervisord]
loglevel=info
logfile=/tmp/supervisord.log
[program:myapp]
command = python3 -u /usr/src/app/manage.py runserver 0.0.0.0:8000
stdout_logfile=/usr/src/app/out.log
stderr_logfile=/usr/src/app/err.log
总是相同的结果,out.log
文件将包含异常发生之前的行,并且不会创建err.log
这是我运行docker compose时得到的输出
2020-05-13 17:33:44,140 INFO supervisord started with pid 1
2020-05-13 17:33:45,144 INFO spawned: 'myapp' with pid 9
2020-05-13 17:33:46,201 INFO success: myapp entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
答案 0 :(得分:1)
经过艰苦的努力,我发现日志已被缓冲,因此解决方案是将pointer
添加到pointer
文件中
修改后的我的conf文件
def unionAll(dict, schema):
dfs = dict.values()
firstDf = dfs[0]
return firstDf.sql_ctx.createDataFrame(
firstDf.sql_ctx._sc.union([df.rdd for df in dfs]),
schema
)