title: NLog - Only log while debugging
body: <p>Take this simple NLog example configuration:</p>
  
  <pre><code>&lt;nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  
      &lt;targets&gt;
          &lt;target name="logfile" xsi:type="File" fileName="file.txt" /&gt;
      &lt;/targets&gt;
  
      &lt;rules&gt;
          &lt;logger name="*" minlevel="Debug" writeTo="logfile" /&gt;
      &lt;/rules&gt;
  &lt;/nlog&gt;
  </code></pre>
  
  <p>How can this be set up to only log while debugging, and not when run in production?</p>
  
  <p>EDIT:</p>
  
  <p>To make things a bit more challenging: My NLog configuration files are centralized, shared over all applications/services/sites. So I would like to avoid altering every single project and just modify the config files.</p>