我正在运行带有官方php:7.3.3-apache
标签的Docker容器。我已安装启用了Monolog的Symfony 4。
通常,monolog使用var/dev.log
,var/prod.log
和var/test.log
来写入其日志,但是您可以将配置更改为php://stdout
或php://stderr
来发送日志到Docker容器。
我的monolog.yaml文件如下:
monolog:
handlers:
main:
type: stream
path: "php://stdout"
level: debug
channels: ["!event"]
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine", "!console"]
它会从网站正确发送日志,但是当我使用php bin/console
命令运行命令时,我会在屏幕上显示日志,例如:
$ php bin/console cache:clear
[2019-06-24 14:29:19] doctrine.DEBUG: SELECT h0_.id AS id_0, h0_.name AS name_1, h0_.value AS value_2, h0_.description AS description_3 FROM hpa_configuration h0_ [] []
[2019-06-24 14:29:19] php.INFO: User Deprecated: The "Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand" class is deprecated since Symfony 4.2, use "Symfony\Component\Console\Command\Command" with dependency injection instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: The \"Symfony\\Bundle\\FrameworkBundle\\Command\\ContainerAwareCommand\" class is deprecated since Symfony 4.2, use \"Symfony\\Component\\Console\\Command\\Command\" with dependency injection instead. at /var/www/html/hpa/vendor/symfony/framework-bundle/Command/ContainerAwareCommand.php:18)"} []
// Clearing the cache for the dev environment with debug ......
如何从网站和命令正确登录?
答案 0 :(得分:0)
将php://stdout
更改为php://stderr