My memory sucks then.

Got it working with these changes

  <system.diagnostics>
    <sources>
      <source name="MockSource" switchName="sourceSwitch"
switchType="System.Diagnostics.SourceSwitch">
        <listeners>
          <add name="consListener"
type="System.Diagnostics.ConsoleTraceListener"/>
          <add name="textfileListener" />
        </listeners>
      </source>
    </sources>
   <switches>
      <add name="sourceSwitch" value="Verbose"/>
    </switches>
  <sharedListeners>
      <add name="textfileListener"
        type="System.Diagnostics.TextWriterTraceListener"
        initializeData="mock.log">
      </add>
    </sharedListeners>
  </system.diagnostics>

And

public void RunAndTrace()
{
mockSource.TraceInformation("Runit is running now");
mockSource.TraceEvent(TraceEventType.Error, 1001, "This is a mock event
error 1001");
            mockSource.Flush();
            mockSource.Close();
}

On Fri, Jan 8, 2016 at 9:34 AM, Greg Keogh <[email protected]> wrote:

> From memory you use the Trace class directly
>> Trace.WriteLine("bla bla");
>>
>
> Nah, I don't think so, I'm using a "TraceSource" and all the samples I've
> seen make a static one, then write to it.
>
> public static TraceSource ts = new TraceSource("MySource");
> :
> ts.TraceInformation("Hello world");
>
> *Greg*
>

Reply via email to