Handle logging inside exception