N
N
nepster-web2019-07-17 18:30:52
PHP
nepster-web, 2019-07-17 18:30:52

Why don't Monolog logs get into "Docker logs"?

Hello. I am setting up work with logs, I want to hook up a certain aggregator and collect all the logs with it. The aggregator receives logs that are visible in docker logs (that is, from stdout and stderr streams).
In my application, I'm trying to write a log to stdout and see it with the docker logs command:

$logger = new \Monolog\Logger('MyTestName');
$handler = new StreamHandler('php://stdout', Logger::DEBUG);
$logger->pushHandler($handler);
$logger->error('My test error message');

However, only nginx is shown in the output of docker logs, no more logs are included.
5d2f3f2627b47036909106.png
Tell me what I missed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chupasaurus, 2019-07-17
@chupasaurus

You run multiple applications inside the same container and naively assume that they all have the same first two file descriptors.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question