0
<system.diagnostics>
    <sources>
        <source name="System.ServiceModel"
                switchValue="Error, ActivityTracing"
                propagateActivity="true">
            <listeners>
                <add name="traceListener"
                     type="System.Diagnostics.XmlWriterTraceListener"
                     initializeData= "c:\logs\Traces.svclog" />
            </listeners>
        </source>
    </sources>
</system.diagnostics>

Hi, I use this config section to trace just the errors from the WCF service, but when I open my svclog file I can see all the activity on the service. How can I log only the errors in my svclog file.

Marc
  • 3,905
  • 4
  • 21
  • 37
arnoldrob
  • 813
  • 3
  • 9
  • 15

2 Answers2

1

Remove "ActivtiyTracing" from the switchValue Attribute

<system.diagnostics>
    <sources>
      <source name="System.ServiceModel"
              switchValue="Error"
              propagateActivity="true">
        <listeners>
          <add name="traceListener"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData= "c:\logs\Traces.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
makim
  • 3,154
  • 4
  • 30
  • 49
1

You can control Tracing by settings the Switch attribute :

 <configuration>
 <system.diagnostics>
    <switches>
       <add name="mySwitch" value="4" />
    </switches>
 </system.diagnostics>

The corresponding values are this :

    Trace Level

Off : 0
Error : 1
Warning : 2
Info : 3
Verbose : 4

On MSDN you will find more explanation

TraceLevel Enumeration

2GDev
  • 2,478
  • 1
  • 20
  • 32