better logging of exceptions