Req #71880 [Com]: Optionally disable warnings when writing to STDOUT

From: Date: Tue, 07 Mar 2017 16:59:08 +0000
Subject: Req #71880 [Com]: Optionally disable warnings when writing to STDOUT
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207721@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71880&edit=1

 ID:                 71880
 Comment by:         bugs dot php dot net at mog dot se
 Reported by:        haertl dot mike at gmail dot com
 Summary:            Optionally disable warnings when writing to STDOUT
 Status:             Open
 Type:               Feature/Change Request
 Package:            FPM related
 Operating System:   Linux
 PHP Version:        5.6.19
 Block user comment: N
 Private report:     N

 New Comment:

Hello.

Neither named pipes or files are good alternatives to stdout when using Docker.

Why is PHP mangling and truncating my log data!?!?!?!?!?


Previous Comments:
------------------------------------------------------------------------
[2016-11-22 21:27:45] dvalentiate at gmail dot com

To makes the php-fpm error logging not crappy I ended up putting

    mkfifo /tmp/stdout && chmod 777 /tmp/stdout

in my a run statement in my Dockerfile, and also setting

    error_log = /tmp/stdout
    access.log = /tmp/stdout

in a php config .ini file and 

    php-fpm | tail -f /tmp/stdout

in my docker-compose command call.

The result is clean PHP error logging.

------------------------------------------------------------------------
[2016-08-26 08:05:20] mark dot sagikazar at gmail dot com

Okay, I still think there is a misunderstanding. I KNOW that we should log to stdout. BUT because of
this bug it is not really developer friendly, SO there is a quick dirty hack:

> CMD service start && tail -f /tmp/stdout

This hack suggested using named pipes and I asked why not use a file instead, which might be the
default for applications.

Of course, when this bug is resolved or someone doesn't care about it, we should use stdout.

------------------------------------------------------------------------
[2016-08-26 07:57:47] haertl dot mike at gmail dot com

> I meant the tailing solution with a log file instead a named pipe.

Because then you have to override the CMD in your Dockerfile. So whenever the CMD in the underlying
official base image changes you must make sure, that you change your line accordingly. This is error
prone as it's easy to miss this step whenever you upgrade to a newer version.

------------------------------------------------------------------------
[2016-08-26 07:49:08] mark dot sagikazar at gmail dot com

> Logging to a file is not an alternative. You also don't want to lose your logfiles when a
> container is recreated.

I think you misunderstood me. I meant the tailing solution with a log file instead a named pipe.

------------------------------------------------------------------------
[2016-08-26 07:28:36] haertl dot mike at gmail dot com

> What's the advantage of using a named pipe instead of a file? The log file should be lost
> with the restart of the container anyway.

Because that's how logging is handled in the docker world. There are many tools that you can
use to dynamically route your logs to different targets, e.g. logspout. PHP-FPM can't be used
in this way due to the issue above.

Logging to a file is not an alternative. You also don't want to lose your logfiles when a
container is recreated.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=71880


--
Edit this bug report at https://bugs.php.net/bug.php?id=71880&edit=1


Thread (16 messages)

« previous php.bugs (#207721) next »