Reverse order of log statement and invoking uncaughtException handler

It doesn't do any good to attempt to log a message after we've
terminated the thread.