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
Fixes #27036 - improve logging of error backtraces #658
Conversation
Ok improved it, actually regression made in: 8652a7e
It's slightly more readable now. After IRC discussion with @ekohl we agreed that adding support for |
1f05ce4
to
98eb206
Compare
98eb206
to
4986cf0
Compare
Rebased, in case you can't boot smart-proxy with "daemon" dependency error - rebase. It was an issue we've fixed this morning. |
lib/try-patch.rb
Outdated
@@ -0,0 +1,50 @@ | |||
# |
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.
Given there's only one usage of this, I'd prefer to hold off on this. If you do have a larger block of code that uses it, then I'd be happy to include it.
4986cf0
to
5b5fc39
Compare
Removed, rebased. |
5b5fc39
to
315fb02
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.
Could you add a test for add
? This is complicated (for historical reasons) and I'd feel better if it had tests.
315fb02
to
36d1fb4
Compare
Rebased, added tests. |
36d1fb4
to
8ff7243
Compare
Fixed rubocop issue, ready for rereview. |
@@ -37,7 +37,7 @@ def parse_config_for_subnets | |||
raise Proxy::DHCP::Error("Only one subnet is supported") if ret_val.size > 1 | |||
ret_val | |||
rescue Exception => e | |||
msg = "Unable to parse subnets XML" | |||
msg = "Unable to parse subnets XML: #{e}" |
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.
Doesn't the , e
to logger.error
already add this information?
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.
Yes but apparently I want the error message to be returned to the client. Our error reporting is sometimes very weak.
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 logger.exception
be useful here (and later in the file)?
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.
Is the specific exception message still needed when using logger.exception
? I think that already formats the message to include the specific exception message.
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.
Any further comments @ekohl? lgtm except for a super minor comment
lib/proxy/log_buffer/decorator.rb
Outdated
backtrace = backtrace.respond_to?(:join) ? backtrace.join("\n") : backtrace | ||
# accepts backtrace, exception and simple string for historical reasons | ||
backtrace = if exception_or_backtrace.is_a?(Exception) && !exception_or_backtrace.backtrace.nil? | ||
exception_or_backtrace.message + ': ' + exception_or_backtrace.backtrace.join("\n").to_s |
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.
not crucial but the .to_s
here is redundent
Rebased. |
8ff7243
to
80f253f
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 appreciate to know how the answer to my question but overall 👍 and can be merged regardless of the answer.
@@ -37,7 +37,7 @@ def parse_config_for_subnets | |||
raise Proxy::DHCP::Error("Only one subnet is supported") if ret_val.size > 1 | |||
ret_val | |||
rescue Exception => e | |||
msg = "Unable to parse subnets XML" | |||
msg = "Unable to parse subnets XML: #{e}" |
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 logger.exception
be useful here (and later in the file)?
80f253f
to
489559f
Compare
I can't comment in the file, so let me put it here. I can add that, this code is probably pre-exception helper. Rebased. |
please rebase @lzap |
489559f
to
89a3a7f
Compare
Rebased. |
Thanks @lzap ! |
Looks like it's not visible at all.