My application is using WCF, And I am creating a service log file on server. It is working correctly, It is writing same svclog file and it is increasing in size.
What would I have to do to create a new svclog file when it reaches a fixed file size like I want it to be 50MB, or it creates a new svclog file for each day.
Currently, The source and listeners have been defined in the web.config file as follows:
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
<listeners>
<add name="ServiceModelTraceListener" />
</listeners>
</source>
<source name="System.ServiceModel" switchValue="Verbose,ActivityTracing">
<listeners>
<add name="ServiceModelTraceListener" />
</listeners>
</source>
<source name="System.Runtime.Serialization" switchValue="Verbose,ActivityTracing">
<listeners>
<add name="ServiceModelTraceListener" />
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="C:\ServiceLogs\app_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp" />
</sharedListeners>
</system.diagnostics>
How can I do this?
You should create a custom trace listener.
There is a perfect sample from MS for this ! This example can not fit exactly with your needs, but it is easy to understand and so to change.
More info here