-
[RESOLVED] Max File Size
Hi All,
I would like to create a log file for one of my applications so that I can limit the size of the file.
At the moment I am going to read in the entire file. If the file is larger then the size limit specified. I was add the new line to an array in memory and the write the file to the array in reverse order up to the size limit specified.
But the performance of my application will suffer if I make a lot of writes to this file.
Does anyone have a better way of handling this type of file writing?
-
Re: Max File Size
I would suggest that when you want to write to the log file you ignore the file size and just use AppendAllText to write. When your app is shutting down, then you could check the file size and trim it if required. That way you aren't reading and trimming over and over while your app is running.