scriptName = sys.argv[0].split("\\")[-1][0:-3] #the script without the .py extension dateTimeStamp = time.strftime('%Y%m%d%H%M%S') #in the format YYYYMMDDHHMMSS userName = string.lower(os.environ.get("USERNAME")) logFile = rootDir + "\\" + scriptName + "_" + userName + "_" + dateTimeStamp + ".log"