changing raise to logger