adding logging of exceptions