Graylog2 with Symfony 2 (Monolog)

╄→гoц情女王★ 提交于 2019-12-04 22:13:20

问题


I want to use the "Monolog -> GelfHandler" in a SF2 project. So I've added the following to my composer.json:

"graylog2/gelf-php": "dev-master"

My SF2 config.yml:

monolog:
    handlers:
        main:
            type: gelf
            publisher:
                hostname: %Graylog2.Host%
                port: %Graylog2.Port%
            level: info
            formatter: monolog.formatter.session_request

But now, if I want to log something, I get an error in GelfHandler::write()

Gelf\Publisher::publish() must be an instance of Gelf\MessageInterface, string given

What is wrong here?


回答1:


ok, i will answer my question by my self. the failure is to change the "formatter" or you have to use a formatter is sub-classes from Monolog\Formatter\GelfMessageFormatter.

thx @ all



来源:https://stackoverflow.com/questions/25764876/graylog2-with-symfony-2-monolog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!