Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to do on demand flushing of WCF trace?

Tags:

flush

trace

wcf

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.

like image 450
Piotr Owsiak Avatar asked Dec 07 '09 18:12

Piotr Owsiak


2 Answers

One way is to do an IIS reset, but this is only really an option when debugging on a developmnet box.

like image 83
Shiraz Bhaiji Avatar answered Nov 18 '22 06:11

Shiraz Bhaiji


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:

  • Stack Overflow: How can I enable WCF logging so that it writes to a Database?'

This would allow you to view your WCF trace in real-time, without flushing it.

like image 29
Daniel Vassallo Avatar answered Nov 18 '22 06:11

Daniel Vassallo