我正試圖使用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配置中配置它?