Just like there is a command to flush IIS7 logs:
netsh http flush logbuffer
I'm wondering is there a similar command to flush WCF trace log on demand.
One way is to do an IIS reset, but this is only really an option when debugging on a developmnet box.
Setting the autoflush="true" in your .config file ensures that the trace sources flush to disk after each trace.
The following is a sample configuration file with autoflush="true":
<configuration>
 <system.diagnostics>
  <sources>
   <source name="System.ServiceModel" switchValue="Warning, ActivityTracing"
                 propagateActivity="true">
     <listeners>
      <add name="xml" type="System.Diagnostics.XmlWriterTraceListener"
                      initializeData="e2eTraceTest.xml" />
    </listeners>
   </source>
  </sources>
  <trace autoflush="true" />
 </system.diagnostics>
</configuration>
In addition, if by any chance you are willing to store your WCF trace in a database, you might want to check out this post:
This would allow you to view your WCF trace in real-time, without flushing it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With