Added logging to exceptions