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

Error logs don't show in stdout #311

Closed
roopemerikukka opened this issue Jun 7, 2018 · 6 comments
Closed

Error logs don't show in stdout #311

roopemerikukka opened this issue Jun 7, 2018 · 6 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@roopemerikukka
Copy link

I'm getting only access logs to the stdout and at least I assume that the error logs should be shown in there also. Im using custom image FROM wordpress:php7.1-fpm-alpine which doesn't touch to any logging options (at least not purposely). The image that I'm using is: https://github.com/bond-agency/docker-wpbp-wordpress

Is there something wrong with the configuration of that image or do I have to turn the logging on separately?

@wglambert
Copy link

In the Dockerfile error_log and access.log are redirected to stderr not stdout.

https://github.com/docker-library/php/blob/master/7.2/alpine3.7/fpm/Dockerfile#L191

&& {
echo '[global]';
echo 'error_log = /proc/self/fd/2';
. . .
echo '[www]';
echo '; if we send this to /proc/self/fd/1, it never appears';
echo 'access.log = /proc/self/fd/2';
. . .
} | tee php-fpm.d/docker.conf \

For why this is: docker-library/php#358 (comment)

php-fpm likely closes STDOUT as part of its own startup routines.

@wglambert wglambert added the question Usability question, not directly related to an error with the image label Jun 7, 2018
@wglambert
Copy link

Issue seems resolved so going to close

@pentago
Copy link

pentago commented Oct 20, 2021

Actually, the issue is not resolved, it's still present in 7.4.* images (haven't try 8.x branch).

@wglambert
Copy link

Because docker logs are read from /dev/stderr and /dev/stdout the log files redirect to stderr
docker-library/php#1174

Anything that would've been written to the error_log or access.log should show up in the docker logs output

@pentago
Copy link

pentago commented Oct 20, 2021

Thing is, I don't use Docker, rather Docker container in Kubernetes. How does that impact PHP-FPM logging?

@wglambert
Copy link

It shouldn't? You're just using kubectl logs instead

For some more info about this nuance see docker-library/php#811 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

3 participants