Move the logging of exceptions before the logging of backtraces

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.
Merge pull request #2110 from iconara/log_exceptions_before_backtraces

Move the logging of exceptions before the logging of backtraces