Modify abort function to separate logging from it