I\'m looking for a good TraceListener for .Net that supports rolling over the log file based on size limits.
Constraints
I had the same issue. Secure environment, no open source allowed. Painful. Here's what worked for us.
Derive from TextWriterTraceListener that adds members for max log size, max rolls to keep, and uses a FileStream with Share and Access set to ReadWrite and set OpenOrCreate. It should also create and hold a mutex with a name based on the filename.
Override TraceEvent method, wait for the mutex, seek the stream to end, call Write, check the size and roll if necessary. Release the mutex.
For rolling, rotate the previous rolls via file move and delete, copy the current file to the first level roll name, call SetLength(0) on the stream. All done within the mutex grab, but hopefully not often. This will work across processes and will avoid that crappy {GUID}mylog.log stuff.