I'm not sure what the deal is, but Nginx will not write errors to stderr. stdout works perfect.
If you remove the hard link for stderr and have it write to /var/log/nginx/error.log, this works:
kill all php-fmf kill -9 $(pidof nginx)
make web request, get 503 error.
In /var/log/nginx/error.log:
2021/01/29 18:51:36 [error] 76#76: *6 connect() to unix:/var/run/php/php7.4-fpm.sock failed (111: Connection refused) while connecting to upstream, client: 192.168.193.5, server: f1c8475c86f4, request: "GET /ndksjfds HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "my_server:7654"
As far as I can tell, it's impossible to make nginx output this to stderr. In the bash init script you can add echo "stderr test" >&2 and it correctly outputs to the docker log.
I would like to submit a [tiny] PR to simplify docker logging a bit, by removing the hard links and having nginx directly write to /dev/stdout. This works, but stderr does not, both using the hard link or having nginx log directly to /dev/stderr results in nothing logged. It appears the best option is to have stderr write to the file, and access go to stdout. This is not ideal, but unless someone can figure this out, the options are:
log stderr (either directly or via a hard link) to docker, which results in all errors being dropped; effectively logging to /dev/null
log stderr to /var/log/nginx/error.log. This is not ideal, but it least the logs are not thrown away.
I'm not sure what the deal is, but Nginx will not write errors to stderr. stdout works perfect.
If you remove the hard link for stderr and have it write to /var/log/nginx/error.log, this works:
kill -9 $(pidof nginx)
As far as I can tell, it's impossible to make nginx output this to stderr. In the bash init script you can add
echo "stderr test" >&2
and it correctly outputs to the docker log.I would like to submit a [tiny] PR to simplify docker logging a bit, by removing the hard links and having nginx directly write to /dev/stdout. This works, but stderr does not, both using the hard link or having nginx log directly to /dev/stderr results in nothing logged. It appears the best option is to have stderr write to the file, and access go to stdout. This is not ideal, but unless someone can figure this out, the options are:
Any ideas?