views:

216

answers:

2

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.

+1  A: 

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

Shiraz Bhaiji
Thanks for reply, that's the only info I found out so far.
Piotr Owsiak
It's been a while and techincally your answer is correct so I accepted it.
Piotr Owsiak
+1  A: 

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.

Daniel Vassallo
That's an option, I'll remember about it, thanks.
Piotr Owsiak
@Piotr: You may also want to consider the `autoflush=true` method, as described in the answer.
Daniel Vassallo
@Daniel: That's what I did eventually. However I would rather have buffering that would conserve resources and allowed flushing either on demand and on buffer overflow (and/or low resource usage). I just think that would be beneficial from server's perspective.
Piotr Owsiak
@Piotr: Yes, I agree with you.
Daniel Vassallo