supervisord disable log files or use logfile=/dev/stdout

Gert Cuykens picture Gert Cuykens · Aug 12, 2017 · Viewed 7.9k times · Source
[supervisord]
nodaemon=true
logfile=/dev/stdout
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisor

When I do this supervisor will crash because it cannot seek in /dev/stdout

How can I disable supervisord creating any log files in my docker container?

Answer

Matt picture Matt · Aug 12, 2017

For the main supervisor, nodaemon will cause logs to go to stdout

[supervisord]
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0

Then send the logs for each managed process to the stdout file descriptor /dev/fd/1

[program:x]
command=echo test
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true

Or if you prefer to keep stderr on a different stream:

[program:x]
command=echo test
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/fd/2
stderr_logfile_maxbytes=0