'How to specify who is logging in supervisord?

I'm trying out supervisord on a docker container to try to control two processes inside a container. For now, process1 types every 10 seconds "I am process 1" and process 2 types "I am process 2". They are both really simple bash scripts that echo a text every 10 seconds.

The problem is that I can see the output in stdout but I can't see who is printing the log. In this example it's not a problem but whenever I deploy multiple programs (postgres and redis for example), I can't identify who is printing each log or see when the log is being printed.

Right now the logs look like:

2022-04-20 05:17:50,729 INFO supervisord started with pid 8
2022-04-20 05:17:51,732 INFO spawned: 'PROGRAM1' with pid 9
2022-04-20 05:17:51,763 INFO spawned: 'PROGRAM2' with pid 10
I am process 1
I am process 2
2022-04-20 05:17:52,778 INFO success: PROGRAM1 entered RUNNING state, process has stayed up 
for > than 1 seconds (startsecs)
2022-04-20 05:17:52,779 INFO success: PROGRAM2 entered RUNNING state, process has stayed up 
for > than 1 seconds (startsecs)
I am process 1
I am process 2

My supervisord.conf looks like this:

[supervisord]
nodaemon=true

[program:program1]
command=/bin/bash /app/process1.sh &
process_name=PROGRAM1
autostart=true
autorestart=true
priority=0
redirect_stderr=true
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stderr

[program:program2]
command=/bin/bash /app/process2.sh &
process_name=PROGRAM2
autostart=true
autorestart=true
priority=0
redirect_stderr=true
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stderr

What is happening here? Is there a problem with my configuration?

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source