suggest adding this in a try/catch.   logging should not generate errors.