Stop Debug.Assert writing to log file
<p>Hi I have a Trace Logger.</p>

<pre><code>using System;
using System.Diagnostics;
using System.Text;

namespace MyTrace
 {
   public static class TraceLogger
    {
        public static void Log(string message, TraceEventType type, string module)
        {

        Log(message, type, module, -1);

    }

    public static void Log(string message, TraceEventType type, string module, int line)
    {
        StringBuilder sb = new StringBuilder();
        sb.AppendLine("========================================================================================");
        sb.AppendLine("Date           :" + DateTime.Now.ToShortDateString());
        sb.AppendLine("Time           : " + DateTime.Now.ToShortTimeString());
        sb.AppendLine("Assertion Type : " + type.ToString());
        sb.AppendLine("File           : " + module);
        sb.AppendLine("line           : " + line);
        sb.AppendLine("Message        : " + message);
        if (line &gt; 0)
        {
            sb.AppendLine("========================================================================================");
        }

        Trace.WriteLine(sb.ToString());
        Debug.Assert(1 == 2, sb.ToString() );

    }

}
</code></pre>

<p>}</p>

<p>And basically I do no want the Debug.Assert(1 == 2, sb.ToString() ); to write to my log file I only wish the Trace.WriteLine(sb.ToString()); to at present both statements write to the log file..</p>

<p>my app config is like so </p>

<p>

  </p>

<pre><code>&lt;assert/&gt;
&lt;trace autoflush="true" indentsize="4"&gt;
   &lt;listeners&gt;
    &lt;add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="application.log" /&gt;
    &lt;!--&lt;remove name="Default" /&gt;--&gt;
  &lt;/listeners&gt;
&lt;/trace&gt;
</code></pre>

<p>
</p>

<p>Any help would be appreciated </p>
