write debug to file