Sky*_*blo 8 php symfony monolog graylog2
我想在SF2项目中使用"Monolog - > GelfHandler".所以我已经将以下内容添加到我的composer.json中:
"graylog2/gelf-php": "dev-master"
Run Code Online (Sandbox Code Playgroud)
我的SF2 config.yml:
monolog:
handlers:
main:
type: gelf
publisher:
hostname: %Graylog2.Host%
port: %Graylog2.Port%
level: info
formatter: monolog.formatter.session_request
Run Code Online (Sandbox Code Playgroud)
但是现在,如果我想记录某些内容,我在GelfHandler :: write()中收到错误
Gelf\Publisher::publish() must be an instance of Gelf\MessageInterface, string given
Run Code Online (Sandbox Code Playgroud)
这有什么不对?
好的,我会自己回答我的问题.失败是改变"格式化程序"或者你必须使用格式化程序是Monolog\Formatter\GelfMessageFormatter的子类.
thx @ all
| 归档时间: |
|
| 查看次数: |
3905 次 |
| 最近记录: |