I have an existing .net service and I want to configure it to write messages to a log file. In the service configuration, I added the following:
<system.diagnostics> <sources> <source name="My.Service" switchValue="All"> <listeners> <add name="text" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\log.txt" traceOutputOptions="Timestamp"/> </listeners> </source> </sources> </system.diagnostics>
The problem is that the log file is becoming very fast, so I was wondering if it was possible to configure some kind of log rotation. Since the process locks the file for writing, it cannot be rotated manually, say, with a script, periodically renaming the file, at least without stopping and restarting the service.
Thanks for any suggestion.
source share