supervisord禁用日志文件或使用logfile =/dev/stdout

Ger*_*ens 7 supervisord docker

[supervisord]
nodaemon=true
logfile=/dev/stdout
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisor
Run Code Online (Sandbox Code Playgroud)

当我这样做时,主管会崩溃,因为它无法在/ dev/stdout中寻找

如何禁用supervisord在docker容器中创建任何日志文件?

Mat*_*att 14

对于主管,nodaemon会导致日志转到stdout

[supervisord]
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0
Run Code Online (Sandbox Code Playgroud)

然后将每个托管进程的日志发送到stdout文件描述符 /dev/fd/1

[program:x]
command=echo test
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
Run Code Online (Sandbox Code Playgroud)

或者如果您希望将stderr保留在不同的流上:

[program:x]
command=echo test
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/fd/2
stderr_logfile_maxbytes=0
Run Code Online (Sandbox Code Playgroud)

  • 这可以工作,但是[supervisord]的标准输出日志现在将在控制台中显示两次 (3认同)
  • 当然是啊,因为`nodaemon`已经在那儿登录了。将其发送到`/ dev / null` (2认同)