0
votes

So in my system, the supervisor captures stderr and stdout into these files:

root@3a1a895598f8:/var/log/supervisor# ls -l
total 24
-rw------- 1 root root 18136 Sep 14 03:35 gunicorn-stderr---supervisor-VVVsL1.log
-rw------- 1 root root     0 Sep 14 03:35 gunicorn-stdout---supervisor-lllimW.log
-rw------- 1 root root     0 Sep 14 03:35 nginx-stderr---supervisor-HNIPIA.log
-rw------- 1 root root     0 Sep 14 03:35 nginx-stdout---supervisor-2jDN7t.log
-rw-r--r-- 1 root root  1256 Sep 14 03:35 supervisord.log 

But I would like to change gunicorn's stdout and stderr log files 'location to /var/log/gunicorn and fixed the file names for monitoring purpose.

This is what I have done in the config file:

[program:gunicorn]
stdout_capture_maxbytes=50MB
stderr_capture_maxbytes=50MB
stdout = /var/log/gunicorn/gunicorn-stdout.log
stderr = /var/log/gunicorn/gunicorn-stderr.log
command=/usr/bin/gunicorn -w 2 server:app

However it does not take any effect at all. Did I miss anything in the configuration?

1

1 Answers

0
votes

Change stdout and stderr to stdout_logfile and stderr_logfile and this should solve your issue.

You can also change childlogdir in the main configuration to make all the child logs appear in another directory. If your are using Auto log mode the logfile names will be auto generated into the childlogdir specified without you needing to set stdout_logfile.

In order for your changes to be reflected you need to either restart the supervisor service with:

service supervisord restart

or

reload the config supervisorctl reload and update the config in the running processes supervisorctl update.

Documentation on this can be found here http://supervisord.org/logging.html#child-process-logs