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...
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Off" >
<!-- Information,ActivityTracing-->
<listeners>
<add name="xmlTraceListener" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Off" >
<listeners>
<add name="xmlTraceListener" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xmlTraceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\WCFLogs\DataPortalTrace.svclog" />
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
Yet there is still trace output being send to the indicated output file. Why is that? What am I missing?
switchValue="Off"
will only controlSystem.ServiceModel
. It does not control theSystem.ServiceModel.MessageLogging
As of my knowledge you can control via
maxMessagesToLog="0"
– you might have already<diagnostics>
tag under<system.serviceModel>
.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 theSystem.ServiceModel.MessageLogging
trace source as follows, it has no effect.Copy
If you want to disable the trace source, you should use the
logMessagesAtServiceLevel
,logMalformedMessages
, andlogMessagesAtTransportLevel
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.