finished writelogfile(), and tested it