Creating a new log file each day

Posted by Jason T. on Stack Overflow See other posts from Stack Overflow or by Jason T.
Published on 2010-05-24T15:32:30Z Indexed on 2010/05/24 18:31 UTC
Read the original article Hit count: 231

Filed under:
|
|
|
|

As the title implies how can I create a new log file each day in C#? Now the program may not necessarily run all day and night but only get invoked during business hours. So I need to do two things.

  1. How can I create a new log file each day? The log file will be have the name in a format like MMDDYYYY.txt
  2. How can I create it just after midnight in case it is running into all hours of the night?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET