logging the exception along with the error message