better logging of exception