mickclifford

How to append date stamp to a log file created in Python

Discussion created by mickclifford on Feb 9, 2011
Latest reply on Feb 9, 2011 by csny490
Hi,

I have a python script which runs as a scheduled task each day, on a Windows 2008 server machine, which creates a log file.  However, I cannot get the log file to be created with a date appended to it.  Other CMD scripts use "update_logfile_%date:~10,4%%date:~7,2%%date:~4,2%.log" but this doesn't work.  I also tried "update_logfile_%Y-%m-%d.out", but that didn't work either.

Ideally, I would like something like this:
update_logfile_2011_02_10.out

Could anyone help please?

Many Thanks,

Mick

Outcomes