Updated exception logging to ensure all exceptions are logged as expected.