dsavell / docker-grav

Docker Container for GRAV CMS
MIT License
40 stars 18 forks source link

stderr does not work #29

Closed mabushey closed 1 year ago

mabushey commented 3 years ago

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:

  1. kill all php-fmf kill -9 $(pidof nginx)
  2. make web request, get 503 error.
  3. 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:

  1. log stderr (either directly or via a hard link) to docker, which results in all errors being dropped; effectively logging to /dev/null
  2. log stderr to /var/log/nginx/error.log. This is not ideal, but it least the logs are not thrown away.

Any ideas?

dsavell commented 3 years ago

Added to a milestone plan, will need some deeper digging on this one.

jaredmoody commented 2 years ago

+1, no errors made it difficult to debug my deploy, having this issue reported helped!

dsavell commented 1 year ago

Stale, please re-raise if still an issue