H
hagaihe
Hello,
My application is writing relevent events to log file on local machine.
Due to amount of transactions i need to open new log everyday and to
save the last one according to the next flow:
If the log file exists , check what is the log file creation date ,
compare it to the running logical day [ DateTime.Now.Day ] and if they
are not the same open new log file and add to the log file name the
creation date [ logfilename_dd_mm_yyyy.log ] and copy all the data from
current existing log to the new one.
So far so good ...
After doing that i delete the existing one [
System.IO.File.Delete(logfile name) ] and starts to write new events in
new log which has the same name by using : System.IO.File.AppendAllText
method. this methood checks if the logfile name which was givven as a
parameter exists and if not first create it.
The problem is when this methood creates the file again after it had
been deleted , the creation date is still of the last day and not of
the currnet logical one.
Does anyone have a solution??
10x.
My application is writing relevent events to log file on local machine.
Due to amount of transactions i need to open new log everyday and to
save the last one according to the next flow:
If the log file exists , check what is the log file creation date ,
compare it to the running logical day [ DateTime.Now.Day ] and if they
are not the same open new log file and add to the log file name the
creation date [ logfilename_dd_mm_yyyy.log ] and copy all the data from
current existing log to the new one.
So far so good ...
After doing that i delete the existing one [
System.IO.File.Delete(logfile name) ] and starts to write new events in
new log which has the same name by using : System.IO.File.AppendAllText
method. this methood checks if the logfile name which was givven as a
parameter exists and if not first create it.
The problem is when this methood creates the file again after it had
been deleted , the creation date is still of the last day and not of
the currnet logical one.
Does anyone have a solution??
10x.