-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[MonologBridge] Reset loggers on workers #40761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
34ad0d8
to
3845558
Compare
3845558
to
895e5af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to provide the "glue" in monolog-bundle
src/Symfony/Bridge/Monolog/Messenger/ResetLoggersWorkerSubscriber.php
Outdated
Show resolved
Hide resolved
895e5af
to
adfa302
Compare
just pushed it: symfony/monolog-bundle#403 |
adfa302
to
005686c
Compare
@@ -1,6 +1,10 @@ | |||
CHANGELOG | |||
========= | |||
|
|||
5.3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -1,6 +1,10 @@ | |||
CHANGELOG | |||
========= | |||
|
|||
5.3.0 | |||
----- | |||
* Added `ResetLoggersWorkerSubscriber` to reset buffered logs in messenger workers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing empty line above
Added -> Add
Thank you @l-vo. |
005686c
to
1d2f7f1
Compare
Sorry for chiming in so late, just giving my 2c of advice: this is a nice feature to have, that is in fact useful for any long-running sf console script, be it a daemon or a huge batch script doing import/export of data and taking many hours to run. As such, it could probably use a better name than 'SomethingWorker', to make it more evident to developers that it is not tied exclusively to the Messenger component. |
@gggeek It would be useful for any long-running process that uses a loop BUT this feature relies on a worker event. It's why it is named somethingWorker 🙂 |
@l-vo doh. I missed the namespace of the event, my bad. Wouldn't it be better then to have the worker emit instead a resetLogs event? |
@gggeek No it wouldn't. The reason is decoupling. The emitted event should not be aware of what the listeners are going to do. |
But then the monolog bridge is forced to know about this event - as well as any other event required by daemon-like scripts. It does not seem very different... |
This PR was merged into the 6.0 branch. Discussion ---------- [MonologBridge] Remove deprecated code | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | #40761 | License | MIT | Doc PR | N/A Commits ------- 53ce26e [MonologBridge] Remove deprecated code
This PR tries to solve some problems with buffered handlers (FingerCrossed) in workers.
Let's consider the default configuration (
stop_buffering: true
):buffer_size
, it's a shame to keep logs of previous messages.Then with (
stop_buffering: false
) (why isn't this the default configuration ?)stop_buffering: true
, logs of previous messages are kept in memoryIn a similar way of
DoctrineClearEntityManagerWorkerSubscriber
, this PR adds aResetLoggersWorkerSubscribber
to reset resettable loggers.Integration in Monolog bundle: symfony/monolog-bundle#403