I want to write some events and exceptions to a log file when my app is running. The log file size is limited to N Megabytes. When the file size is more than N Megabytes, I want to overwrite from the start of the file. Since the file size is N megabytes I don’t want to copy to temporary file and then rename it.
Give any suggestions/approach for the above problem.
If your question refers to the .Net trace listener which writes .svclog files then the answer is no: you cannot configure it to start writing from the beginning when it reaches a certain limit.
However, Microsoft have a solution called Circular Tracing that you can try to circumvent the problem of log files growing without limit.