Fix exception logging.