Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logs (access.log, error.log) to stdErr #358

Closed
tchiotludo opened this issue Jan 2, 2017 · 7 comments

Comments

@tchiotludo
Copy link

commented Jan 2, 2017

This configuration seems normal to everyone :

[global]
error_log = /proc/self/fd/2 

; if we send this to /proc/self/fd/1, it never appears
access.log = /proc/self/fd/2

But this really sucks, the access log is merged with the error log.
The fpm config doesn't allow us to catch true error (error output on catch error), the fpm log info & the access log.

I can see that the the comment is true, if you try anything else that is docker supported (/dev/stdout, ...) doesn't seems to work.
But I really wonder what is the reason since other docker image works well. I really want to report the bug to the right repositories.

I've the impression that is fpm related bug but I can't find any issue reported about this.
Any help will be really appreciate.

@gajus

This comment has been minimized.

Copy link

commented Jan 3, 2017

I am not even getting this far... I am not able to get logs in the console at all.

I can see that php-fpm.d/docker.conf is being created, and this is my php.ini configuration.

However, unless I add echo "php_admin_flag[log_errors] = On">>/usr/local/etc/php-fpm.conf to my Dockerfile, I am not getting any logs.

Is there something I am overlooking?

gajus added a commit to gajus/sinonimai.lt that referenced this issue Jan 3, 2017
fix: enable error logging
Need to keep an eye on docker-library/php#358 to find out what is the reason that the `php_admin_flag[log_errors]` is necessary.
@ghost

This comment has been minimized.

Copy link

commented Jan 4, 2017

@tchiotludo

This comment has been minimized.

Copy link
Author

commented Jan 4, 2017

@gajus : try to replace
error_log = /var/log/php-errors.log by error_log = /dev/stderr and it must be working

logging to docker must be to files like /dev/stderr, /dev/stdout, /proc/self/fd/2, /proc/self/fd/1 in by capture by docker daemon

@tianon

This comment has been minimized.

Copy link
Member

commented Jan 6, 2017

Yeah, I'd love to have a decent fix for this, but we haven't found one yet -- I'm guessing that the reason /proc/self/fd/1 (and /dev/stdout, which is a symlink to /proc/self/fd/1) doesn't work is that php-fpm likely closes STDOUT as part of its own startup routines. 😞

@tchiotludo

This comment has been minimized.

Copy link
Author

commented Jan 7, 2017

created a bug report on php : https://bugs.php.net/bug.php?id=73886, wait and see

@tchiotludo

This comment has been minimized.

Copy link
Author

commented Feb 1, 2017

for information : php/php-src#2310
It's being discussed internally with a patch available.
@tianon you have right, the patch show that the STDOUT is closed, and the patch don't close it anymore.
Hope this will be accepted 🤞

@tianon

This comment has been minimized.

Copy link
Member

commented Dec 22, 2017

Closing since this is a bug in upstream's handling of stdout, not something we can reasonably fix in the image.

I'd love to see a PR which adds https://bugs.php.net/bug.php?id=73886 and php/php-src#2310 as context to our existing comment for future reference (and so we have an obvious place to go look for when this can be adjusted), though! ❤️

ala:

; if we send this to /proc/self/fd/1, it never appears
; see https://bugs.php.net/bug.php?id=73886
; and https://github.com/php/php-src/pull/2310
access.log = /proc/self/fd/2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.