-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
prevent recursion with log events #39366
Conversation
Signed-off-by: Robin Appelman <[email protected]>
try { | ||
$this->eventDispatcher->dispatchTyped(new BeforeMessageLoggedEvent($app, $level, $entry)); | ||
} catch (Throwable $e) { | ||
// ignore exceptions from inside the logger, as trying to log them would lead to recursion |
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.
But that means a syntax error in BeforeMessageLoggedEvent class would go unnoticed, no?
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.
I guess, but that seems better than breaking any logging from such an error.
(also static analysis would detect that specific error)
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.
But the inLogEvent boolean is already avoiding recursion on this call, no?
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.
True, but an exception in the logging would still cause issues. We have similar logic in other logging places iirc
Conflicts |
Prevent the event handling of a log event from creating more log events and causing infinite recursion.