473,671 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TraceSwitch

Hi,

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

testapp.exe.con fig
_______________ _____
<?xml version="1.0" encoding="utf-8"?>
<configuratio n>
<system.diagnos tics>
<switches>
<add name="GlobalTra ce" value="3" />
</switches>
</system.diagnost ics>
</configuration>
_______________ ______

C# code
_______________ ______
public static System.Diagnost ics.TraceSwitch
generalSwitch =
new
System.Diagnost ics.TraceSwitch ("GlobalTrac e", "Entire Application");
_______________ ______

What am i doing wrong? I am trying to get generalSwitch.T raceVerbose
set to true for debugging through an XML file.
Thanks,
Mark

Nov 17 '05 #1
2 2553
nh******@newsgr oup.nospam wrote:
Hi,

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

testapp.exe.con fig
_______________ _____
<?xml version="1.0" encoding="utf-8"?>
<configuratio n>
<system.diagnos tics>
<switches>
<add name="GlobalTra ce" value="3" />
</switches>
</system.diagnost ics>
</configuration>
_______________ ______

C# code
_______________ ______
public static System.Diagnost ics.TraceSwitch
generalSwitch =
new
System.Diagnost ics.TraceSwitch ("GlobalTrac e", "Entire Application");
_______________ ______

What am i doing wrong? I am trying to get generalSwitch.T raceVerbose
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.con fig.

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.n l> wrote:
nh******@newsg roup.nospam wrote:
Hi,

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

testapp.exe.con fig
_______________ _____
<?xml version="1.0" encoding="utf-8"?>
<configuratio n>
<system.diagnos tics>
<switches>
<add name="GlobalTra ce" value="3" />
</switches>
</system.diagnost ics>
</configuration>
_______________ ______

C# code
_______________ ______
public static System.Diagnost ics.TraceSwitch
generalSwitch =
new
System.Diagnost ics.TraceSwitch ("GlobalTrac e", "Entire Application");
_______________ ______

What am i doing wrong? I am trying to get generalSwitch.T raceVerbose
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.co nfig.

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
1277
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 particular user). Those switches are set in app.config Now I am looking for a way to know when these settings in my app.config have changed (for example, when changing the tracelevel) at runtime, so that my application can use the new settings. When...
2
1823
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 together from my understanding but doesn't work. AssemblyInfo.cs ------------------
0
1157
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 library(.dll)cannot read from configuration file.So how about traceswitch. thank you
3
2774
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" /> </switches> <trace autoflush="false" indentsize="4"> <listeners>
1
3401
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. 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:
4
4501
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 Trace.WireteLineIf(MySwitch.TraceError,"text"); in my code. Having defined TExtWriterTraceListener. But this has no effect and I can't get any tracefile created, is this a limitation of web services ?
6
4796
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? Is there a way to get a stack trace of the crashing program (by the way, i'm new to C#.net, i have experience in (unmanaged) C++). Thanks in advance.
0
1101
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 config file should look like this, for example: <configuration> <system.diagnostics> <switches> <add name="FirstSwitch" value="1" includeMethodName="1" /> <add name="SecondSwitch" value="1" includeMethodName="1" />
0
962
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
8485
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8403
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8930
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8828
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
5704
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4417
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.