[PATCH 2/3] Add logging to exception handling