writing to log in excpetions