为什么在“码头工人日志”中我无法从独白中获取日志?

时间:2019-07-17 15:48:25

标签: php docker logging stdout monolog

docker logs中,我仅看到nginx消息,而看不到来自独白的消息

https://i.stack.imgur.com/1iRjV.png

我尝试向stdout流发送一些消息,并在$logger = new \Monolog\Logger('MyTestName'); $handler = new StreamHandler('php://stdout', Logger::DEBUG); $logger->pushHandler($handler); $logger->error('My test error message'); 中看到它

docker logs
Cannot update during an existing state transition (such as within 'render'). Render methods should be a pure function of props and state中的

将是我的错误消息

1 个答案:

答案 0 :(得分:0)

在您的php.ini中,添加以下几行:

log_errors = On
error_log = /dev/stderr

现在您将能够看到任何PHP错误日志:

docker logs -f php_container