Properly handle append text to the log file.