Added exception logging.