4

使用 Gelf 记录器记录警报时出现此错误。

运行时异常

Failed to write to socket: fwrite(): send of 136 bytes failed with errno=111 Connection refused (8)

代码

$transport = new UdpTransport("127.0.0.1", 6379, UdpTransport::CHUNK_SIZE_LAN);

$publisher = new Publisher();
$publisher->addTransport($transport);

$message = new \Gelf\Message();
$message->setShortMessage("Foobar!")
        ->setLevel(\Psr\Log\LogLevel::ALERT)
        ->setFullMessage("There was a foo in bar")
        ->setFacility("example-facility")
;

$publisher->publish($message);

$logger = new \Gelf\Logger($publisher, "example-facility");
$logger->alert("Foobaz!"); //getting error here
dd($logger);

我正在这个端口上启动 redis 服务器6379。但不知道为什么我会遇到 fwrite 问题。

4

0 回答 0