Using log instead of printStackTracd