Fix to retrieve full backtrace.

record.exc_info seems to be None in some cases, so using sys.exc_info instead.