fix text file logging with test case