monolog
monolog copied to clipboard
SlackHandler does not timeout
Monolog version 1.26.1
In a Laravel application we are using the SlackHandler for verbose logging. We see from our APM New Relic that certain logging processes are taking much longer than we allow them to.

$handler = new SlackHandler($key, '#notices', 'username', true, null, Logger::NOTICE, false, false, true);
$handler->setConnectionTimeout(2);
$handler->setTimeout(4);
$monolog->pushHandler($handler);
$handler = new SlackHandler($key, '#warnings', 'username', true, null, Logger::WARNING, false, false, true);
$handler->setConnectionTimeout(2);
$handler->setTimeout(4);
$monolog->pushHandler($handler);
$handler = new SlackHandler($key, '#errors', 'username', true, null, Logger::ERROR, false, false, true);
$handler->setConnectionTimeout(2);
$handler->setTimeout(4);
$monolog->pushHandler($handler);
I'm looking for any advice on how to further analyze and control this.
@Flightfreak Can you please give more info about this.
As far as I see in the image, the timeout limit was never reached (not connection or normal timeout).
I mean, your image shows a total time of 1160 ms ... that is 1.16 seconds ... right? As far as I understand the timeout values you are setting are expressed in seconds.
Maybe I am not getting the picture, in that case, please provide more info. Thanks in advance.
@juan-morales thank you for stepping in. It is actually 1 160 000 ms that is 19 minutes.
@Flightfreak @Seldaek I created a pull request: #1606
is a draft pull request, which I would like your opinion about it as I am not 100% sure if is a proper solution.
(some tests are failing, but still would like an opinion, in the meanwhile I will try to fix the failing tests)
Change is ready
Thank you @juan-morales! I'm not familiar enough with the related stream functionalities but I will try to test this.
any updates on this one? :ok_man: