Move the logging of exceptions before the logging of backtraces#2110
Merged
headius merged 1 commit intojruby:masterfrom Nov 5, 2014
Merged
Move the logging of exceptions before the logging of backtraces#2110headius merged 1 commit intojruby:masterfrom
headius merged 1 commit intojruby:masterfrom
Conversation
When -Xlog.backtraces=true and -Xlog.exceptions=true are used together the backtrace is logged before the exception, which is the opposite of what you would expect, and makes the output harder to understand. This moves the logging of exceptions to before the code that triggers the logging of the backtraces. This is not a fantastic solution, there’s nothing in this change that makes sure that the order stays this way, as soon as someone else does a refactoring of the code this will probably become inconsistent. However, I’ve followed the code to find out how the backtraces and exceptions are logged, and this change is the only one I could come up with that wouldn’t require a much more dangerous operation.
Member
|
This looks like an OK fix. Perhaps we can come up with a test for it? Shouldn't be hard to check that the output of a child matches proper order. |
headius
added a commit
that referenced
this pull request
Nov 5, 2014
Move the logging of exceptions before the logging of backtraces
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
-Xlog.backtraces=true and -Xlog.exceptions=trueare used together the backtrace is logged before the exception, which is the opposite of what you would expect, and makes the output harder to understand.This moves the logging of exceptions to before the code that triggers the logging of the backtraces.
This is not a fantastic solution, there’s nothing in this change that makes sure that the order stays this way, as soon as someone else does a refactoring of the code this will probably become inconsistent.
Here's a flowchart of who's calling whom to print the exception and the backtraces. I made it just to see if I could find a better way of making sure the exception is printed before the backtrace, but I think it would be too dangerous if I tried, I don't know how to check for things that would break: