Folks, is there some problem with the System.Diagnostics.TraceSource class
in .NET Core? I copied some perfectly working logging code from an old
Console command to a new command and I get no output on the console or in
the VS2019 output window. The only difference is the new project is .NET
Core.

Some search results hint that TraceSource is not implemented, but they are
years old. Surely classic tracing would be working in .NET Core now?!

*Greg K*

public static TraceSource ts = new TraceSource("MockSource");

ts.TraceInformation("HELLO");

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.diagnostics>
    <sources>
      <source name="MockSource" switchName="switch1"
switchType="System.Diagnostics.SourceSwitch">
        <listeners>
          <add name="consListener"
type="System.Diagnostics.ConsoleTraceListener"/>
        </listeners>
      </source>
    </sources>
    <switches>
      <add name=" switch1  " value="Verbose"/>
    </switches>
  </system.diagnostics>
</configuration>

Reply via email to