TraceSwitch

  • Thread starter Thread starter nhmark64
  • Start date Start date
N

nhmark64

Hi,

When i run testapp.exe the testapp.exe.config file i have in the
DEBUG directory gets deleted, and the TraceSwitch in my code never
gets set.

testapp.exe.config
____________________
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<switches>
<add name="GlobalTrace" value="3" />
</switches>
</system.diagnostics>
</configuration>
_____________________

C# code
_____________________
public static System.Diagnostics.TraceSwitch
generalSwitch =
new
System.Diagnostics.TraceSwitch("GlobalTrace", "Entire Application");
_____________________

What am i doing wrong? I am trying to get generalSwitch.TraceVerbose
set to true for debugging through an XML file.


Thanks,
Mark
 
Hi,

When i run testapp.exe the testapp.exe.config file i have in the
DEBUG directory gets deleted, and the TraceSwitch in my code never
gets set.

testapp.exe.config
____________________
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<switches>
<add name="GlobalTrace" value="3" />
</switches>
</system.diagnostics>
</configuration>
_____________________

C# code
_____________________
public static System.Diagnostics.TraceSwitch
generalSwitch =
new
System.Diagnostics.TraceSwitch("GlobalTrace", "Entire Application");
_____________________

What am i doing wrong? I am trying to get generalSwitch.TraceVerbose
set to true for debugging through an XML file.

Silly question from my part: do you have an app.config in your C#
project? If not, add one and add your configuration xml to that config
file. When building your app, the app.config file will become
testapp.exe.config.

For the rest, your setup looks ok at first glance.

FB

--
 
That was the problem. Thanks very much!
Mark


Silly question from my part: do you have an app.config in your C#
project? If not, add one and add your configuration xml to that config
file. When building your app, the app.config file will become
testapp.exe.config.

For the rest, your setup looks ok at first glance.

FB
 
Back
Top