473,421 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,421 software developers and data experts.

TraceSwitch

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

Nov 17 '05 #1
2 2543
nh******@newsgroup.nospam wrote:
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

--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Nov 17 '05 #2
That was the problem. Thanks very much!
Mark
On Fri, 17 Jun 2005 01:32:37 -0700, "Frans Bouma [C# MVP]"
<pe******************@xs4all.nl> wrote:
nh******@newsgroup.nospam wrote:
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


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kevin Meiresonne | last post by:
I have developed an XML-based tracelistener which uses a booleanswitch (enable/disable), a general traceswitch (set the tracelevel) and a userspecific traceswitch (set the tracelevel for a...
2
by: Peter | last post by:
Hello, Thanks for reviewing my question. I am trying to understand how to use a configuration file for my application, so I can turn debug or trace with a switch. The following is what I put...
0
by: emy | last post by:
hello and hye everyone... can i know whether a .dll can read from traceswitch configuration file.I tried for windows application and it work well..because as far as i read, class...
3
by: Shawn Melton | last post by:
I cannot get a clean compile if I add Trace configuration info into my web.config. This generates an error: <configuration> <system.diagnostics> <switches> <add name="MyTraceSwitch" value="4"...
1
by: David | last post by:
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....
4
by: WT | last post by:
Hello, Using .NET 2 and visual studio 2005 for writting asmx web services. For asp.net web sites I used to implement trace system using TraceSwitch set in web.config. Using...
6
by: bjornms | last post by:
The application i build in C#.net is crashing once a month. I can't reproduce the crash. Is there a way to track down where the program crashes, without putting logging everywhere in the code?...
0
by: PhilipDaniels | last post by:
I'm trying to create a tracing system for my application. I want to create a new type of Switch that is basically TraceSwitch with an extra attribute called "includeMethodName". So my application's...
0
by: =?Utf-8?B?QXJuZSBHYXJ2YW5kZXI=?= | last post by:
How do I connect a TraceSwitch to a value in <system.diagnostics> <switches> -- Arne Garvander Certified Geek Professional Data Dude
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.