title: Turning tracing off via app.config
body: <p>I'm trying to use System.Diagnostics to do some very basic logging. I figure I'd use what's in the box rather than taking on an extra dependency like Log4Net or EntLib. </p>
  
  <p>I'm all set up, tracing is working wonderfully. Code snippet:</p>
  
  <pre><code>Trace.TraceInformation("Hello World")
  </code></pre>
  
  <p>App.config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;system.diagnostics&gt;
      &lt;trace autoflush="true" indentsize="4"&gt;
        &lt;listeners&gt;
          &lt;add name="TraceListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="Trace.log" traceOutputOptions="DateTime" /&gt;
          &lt;remove name="Default" /&gt;
        &lt;/listeners&gt;
      &lt;/trace&gt;
    &lt;/system.diagnostics&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>and my little "Hello World" shows nicely up in my Trace.log file. But now I'd like to switch OFF tracing, so I dig into MSDN and find <a href="http://msdn.microsoft.com/en-us/library/t06xyy08(v=VS.100).aspx" rel="noreferrer">How to: Configure Trace Switches
  </a>. I add the <code>&lt;switches&gt;</code> element, and now my app.config looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;system.diagnostics&gt;
      &lt;trace autoflush="true" indentsize="4"&gt;
        &lt;listeners&gt;
          &lt;add name="TraceListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="Trace.log" traceOutputOptions="DateTime" /&gt;
          &lt;remove name="Default" /&gt;
        &lt;/listeners&gt;
      &lt;/trace&gt;
      &lt;switches&gt;
        &lt;add name="Data" value="0" /&gt;
      &lt;/switches&gt;
    &lt;/system.diagnostics&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>The <code>value="0"</code> should turn off tracing - at least if you then follow <a href="http://msdn.microsoft.com/en-us/library/t20ke01d.aspx" rel="noreferrer">How to: Create and Initialize Trace Switches</a>, which tells you to add this line of code:</p>
  
  <pre><code>Dim dataSwitch As New BooleanSwitch("Data", "DataAccess module")
  </code></pre>
  
  <p>That doesn't make sense to me: I just have to declare an instance of the <code>BooleanSwicth</code> to be able to manage (disable) tracing via the .config file? Should I like ... <em>use</em> ... the object somewhere?</p>
  
  <p>Anyways, I'm sure I missed something really obvious somewhere. Please help.</p>
  
  <p><strong>How do I switch OFF tracing in app.config?</strong></p>