1

I cannot seem to view the trace messages for the Simple.Data library. I am using the Postgresql provider.

I have added the following to the web config to ensure all the messages will come through:

system.diagnostics>
    <switches>
      <add name="Simple.Data" value="4" />
    </switches>
  </system.diagnostics>

But still nothing. I can see the output that I write to the trace using Trace.Write("test");

Tried adding a custom listener, but this also only picked up my generated messages. Do I need to enable tracing somehow in the Simple.Data library?

Paul Grimshaw
  • 19,894
  • 6
  • 40
  • 59

1 Answers1

0

Rather than using a numerical value for the switch level, use the name. It's more reliable. so in your case:

<system.diagnostics>
    <switches>
        <add name="Simple.Data" value="Verbose" />
    </switches>
</system.diagnostics>

(Replace Verbose with 'Info', 'Warning', 'Error' or 'Off' as needed)

Should you wish to control the trace via code you can use SimpleDataTraceSources eg:

SimpleDataTraceSources.TraceSource.Switch.Level = SourceLevels.Verbose;
Graeme Bradbury
  • 3,693
  • 22
  • 29