Uses the correct way to log exceptions.