我正试图使用gelf格式将日志从symfony 2应用流式传输到graylog 2服务器。Graylog/Symfony2/Gelf:如何配置记录器以忽略错误?
我的独白配置如下所示:
monolog:
handlers:
# --- 8< ---
# ...
# --- >8 ---
graylog:
type: gelf
publisher:
hostname: my-graylog-server.com
port: 12201
level: debug
formatter: app.gelf_formatter
当graylog服务器不可用时,我得到的(可以理解)拒绝连接错误
[2017-07-28 16:03:25] app.ERROR: Failed to write to socket: fwrite(): send of 153 bytes failed with errno=111 Connection refused (8) [] []
导致内部服务器错误( 500响应代码引起日志的请求)。
(另见这个问题:Prevent Internal Server Error with Symfony 2/Monolog on failed gelf connection)
GELF-PHP提供了一个IngoreErrorTransportLogger,这似乎是建立这一确切目的。
我如何在Symfony的monolog配置中配置它?