title: Can I control WCF Tracing programmatically?
body: <p>I recently read <a href="http://professionalaspnet.com/archive/2010/09/02/Turn-on-WCF-Tracing-for-WCF-Troubleshooting.aspx" rel="nofollow noreferrer">Chris Love's advice on using WCF Tracing to help with troubleshooting</a>.<br>
  He turns on the tracing by adding new sections of XML to the <code>app.config</code> file and I have since seen <a href="https://stackoverflow.com/questions/4271517/how-to-turn-on-wcf-tracing">similar recommendations here for the same technique</a>.</p>
  
  <p>However we don't really want to ship multiple <code>app.config</code> files.<br>
  And we definitely don't want our customers modifying them on production systems!</p>
  
  <p><strong>Is there a way that the various settings for WCF Tracing can be set up in the app.config, but the tracing is turned on/off from code?</strong> </p>
  
  <p>Ideally I'd like my application to check the registry and only activate the tracing when a certain value was present.</p>