WCF Tracing switchvalue is Off yet there is still a trace output being generated

前端 未结 1 1478
不知归路
不知归路 2021-02-09 08:27

After having turned on WCF Tracing to assist with finding a problem, I now wish to turn off tracing. So I have changed my config file to this...



        
相关标签:
1条回答
  • 2021-02-09 08:52

    switchValue="Off" will only control System.ServiceModel. It does not control the System.ServiceModel.MessageLogging

    As of my knowledge you can control via maxMessagesToLog="0" – you might have already <diagnostics> tag under <system.serviceModel>

    <diagnostics>
          <messageLogging
               logEntireMessage="true"
               logMalformedMessages="true"
               logMessagesAtServiceLevel="true"
               logMessagesAtTransportLevel="true"
               maxMessagesToLog="0"
           />
    </diagnostics>
    

    .NET framework for Configuring Message Logging

    The logging level, as well as the additional options, are discussed in the Logging Level and Options section.

    The switchValue attribute of a source is only valid for tracing. If you specify a switchValue attribute for the System.ServiceModel.MessageLogging trace source as follows, it has no effect.

    Copy

     <source name="System.ServiceModel.MessageLogging" switchValue="Verbose">
    

    If you want to disable the trace source, you should use the logMessagesAtServiceLevel, logMalformedMessages, and logMessagesAtTransportLevel attributes of the messageLogging element instead. You should set all these attributes to false. This can be done by using the configuration file in the previous code example, through the Configuration Editor UI interface, or using WMI. For more information about the Configuration Editor tool, see Configuration Editor Tool (SvcConfigEditor.exe). For more information about WMI, see Using Windows Management Instrumentation for Diagnostics.

    0 讨论(0)
提交回复
热议问题