Help with "TraceSwitch "

D

David

I am attempting to use "TraceSwitch " in Win Forms (Below is the code
and the app.config). According to the manual, the program should
read the config for the setting, but this is not occurring. The
examples in the SDK and on the web appear to match mine, but I am not
sure if there is an error with my code or some additional setting.

====

The code is:

static TraceSwitch GeneralTS = new TraceSwitch("GeneralTS", "Entire
Application");

and the App.config is:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<switches>
<add name="Trace01" value="1" />
</switches>
</system.diagnostics>
</configuration>

Howe
 
J

John Vottero

David said:
I am attempting to use "TraceSwitch " in Win Forms (Below is the code
and the app.config). According to the manual, the program should
read the config for the setting, but this is not occurring. The
examples in the SDK and on the web appear to match mine, but I am not
sure if there is an error with my code or some additional setting.

====

The code is:

static TraceSwitch GeneralTS = new TraceSwitch("GeneralTS", "Entire
Application");

and the App.config is:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<switches>
<add name="Trace01" value="1" />
</switches>
</system.diagnostics>
</configuration>

Your trace switch is named "GeneralTS" in the code but it's called "Trace01"
in your config file. These names must match.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top