mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 08:05:53 +03:00
[GH-ISSUE #1100] DeduplicationHandler with cli app instead of cgi #449
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#449
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 @never1sdead on GitHub (Dec 26, 2017).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1100
I'm using DeduplicationHandler in my socket application.
The problem is that DepulicationHandler is a BufferHandler with null bufferLimit(unlimited). It will keep the logs indefinitely untill I shut down the process.
Now the only way to flush the error logs is to expose the refrence to DepulicationHandler instance and call
flash()every 60s in a timer, which isn't not quite convenient when there are a lot of loggers.It would be great to allow DepulicationHandler to use a time based bufferLimit. Like flushing every 60s when next log arrives. I think it can be done by overriding the
handler()method.@Seldaek commented on GitHub (Jun 18, 2018):
I think the best solution here would be to call close() on it at the end of every "job" or whatever you are doing on the CLI. Which would flush every time as if it was a web request in a fcgi context. Monolog 2.0 should have close() available on the Logger instance to facilitate this, but in 1.x you can already call close on the DeduplicationHandler as you mentioned. Using a time-based approach sounds a bit too specific IMO and everyone will have different requirements there. Closing as the close() stuff is already tracked in #197