- <system.diagnostics>
- <sources>
- <source name="System.ServiceModel.MessageLogging">
- <listeners>
- <add name="messages"
- type="System.Diagnostics.XmlWriterTraceListener"
- initializeData="c:\logs\messages.svclog" />
- listeners>
- source>
- sources>
- system.diagnostics>
- <system.serviceModel>
- <diagnostics>
- <messageLogging
- logEntireMessage="true"
- logMalformedMessages="false"
- logMessagesAtServiceLevel="true"
- logMessagesAtTransportLevel="false"
- maxMessagesToLog="3000"
- maxSizeOfMessageToLog="2000"/>
- diagnostics>
- system.serviceModel>
How can I rotate the log, for example write to messages1.svclog, then messages2.svclog, etc. when the number of messages in the last log has reached maxMessagesToLog=3000?
I read the article [A Rolling XmlWriterTraceListener](https://www.codeproject.com/Articles/30956/A-Rolling-XmlWriterTraceListener), but this rotates the log file when a certain file size has been reached. However, when the number of messages reaches maxMessagesToLog, WCF will stop logging.
Replies
Know the answer? Post it — somebody with the same question will find it here.