-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Improve exception serializing #35970
Conversation
Or wait, it may still help if the error was not logged due to a lower log level. |
Should also fix (resp. circumvent) #23429 |
330523b
to
e0d92cd
Compare
e0d92cd
to
6c996ee
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.
👍 otherwise
lib/private/Log.php
Outdated
@@ -312,6 +312,11 @@ public function logException(Throwable $exception, array $context = []) { | |||
$app = $context['app'] ?? 'no app in context'; | |||
$level = $context['level'] ?? ILogger::ERROR; | |||
|
|||
$minLevel = $this->getLogLevel($context); | |||
if ($level < $minLevel && !$this->crashReporters->hasReporters()) { |
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.
$this->crashReporters
needs a null check
6c996ee
to
ecf0793
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.
wondering about #35970 (comment)
…alizing an exception Signed-off-by: Julius Härtl <[email protected]>
This will avoid running into a Nesting level too deep error as the encodeArg calls will limit potential recursive calls on the arguments to a nesting level of 5 Signed-off-by: Julius Härtl <[email protected]>
Signed-off-by: Julius Härtl <[email protected]>
ecf0793
to
cf1bd0e
Compare
/backport 7daa20d to stable25 |
/backport 7daa20d to stable24 |
Summary
Small improvement to not start serializing an exception during logging if the log level would skip it anyways. Noticed when seeing errors due to
Nesting level too deep - recursive dependency? at /var/www/html/lib/private/Log/ExceptionSerializer.php#215
while there was no actual error logged when commenting out the argument cleanupThe second commit avoids such cases by handling the arguments first (which limits to a recursion depth of 5) before iterating over them for filtering for sensitive parameters.
Checklist