【发布时间】:2019-06-24 14:47:37
【问题描述】:
我正在运行一个带有官方 php:7.3.3-apache 标签的 docker 容器。我安装了启用独白的 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 ......
如何从网站和命令正确登录?
【问题讨论】:
-
嗨!你终于找到解决这个问题的方法了吗?谢谢!