mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 08:05:53 +03:00
[GH-ISSUE #729] SlackHandler doesn’t work #272
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#272
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @r3nat on GitHub (Feb 8, 2016).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/729
monolog 1.15.0, tried 1.17.1
30-70% of messages are lost without error.
Adding
fread($this->resource, 8192);to the end ofSocketHandler->writeToSocketfixes the problem, although it looks like dirty hack.@Aliance commented on GitHub (Feb 8, 2016):
+1
@GeeH commented on GitHub (Feb 18, 2016):
+1 :trollface:
@pprishchepa commented on GitHub (Mar 1, 2016):
+1
@stloyd commented on GitHub (Mar 1, 2016):
Unfortunatelly can confirm that if amount of logs is quite big, slack handler loses those messages.
@pprishchepa commented on GitHub (Mar 1, 2016):
@stloyd In my case it is not correlate with amount of logs. It's about 1 message per 10 seconds.
@r3nat
Adding fread($this->resource, 8192);helps me too, thanks.@Seldaek commented on GitHub (Mar 1, 2016):
I don't really see what the fread does there.. Can someone try and explain? Do you add it at the very end or does it also work around SocketHandler line 294 just after the fwrite?
Also could you maybe var_dump what the fread() returns to see what is being sent back by slack that we need to acknowledge for it to not drop messages?
Another fix would be to add a fread() inside SlackHandler::write before closing the handler I guess. I don't really want to apply this blindly to all SocketHandler derivatives as it might cause issues.
@r3nat commented on GitHub (Mar 2, 2016):
I think if socket closes too early, than slack will not process request.
Adding
usleep(10000)instead offreaddoes the trick too.Result of
fread:@lesaff commented on GitHub (Mar 3, 2016):
To confirm @r3nat, this works 👍
SlackHandler.php, line 236