Added a flag to clear the logfile