473,799 Members | 3,029 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting up tracing in config file (windows form app)

The documentation on this subject seems to give you 98% of what you need to
know. From various sources, I have compiled an understanding that this
should work:

<configuratio n>
<system.diagnos tics>
<switches>
<add name="clientswi tch" value="3" />
</switches>
<trace autoflush="true " indentsize="0">
<listeners>
<add name="traceList ener" type="System.Di agnostics.TextW riterTraceListe ner,
system version=1.0.500 0.0, Culture=neutral ,
PublicKeyToken= b77a5c561934e08 9" initializeData= "TraceLog.t xt" />
</listeners>
</trace>
</system.diagnost ics>
</configuration>

(Pardon the formatting, hard to get it pretty with plain text ya know)

When I execute this line in my code:
Trace.WriteLine ("Starting client Form1");
I get a ConfigurationEx ception which says "Couldn't find type for class
System.Diagnost ics.TextWriterT raceListener, system version=1.0.500 0.0, "
etc. (the whole fqn from the config file is shown).

I can't find an actual fully working example on gotdotnet or msdn, and like
I said the documentation just points you in the general direction but
doesn't really give you the complete answer.

Is there anybody that has this working and can give me some pointers?
Nov 15 '05 #1
3 9512
The version below works for me. It has the advantage to be .NET version
independant :-)

<trace autoflush="true " indentsize="4">
<listeners>
<!-- With the following line, you define the location where the
tracing will
be stored related to the LocalLogSwitch. To disable output,
comment the next line -->
<add name="BTListene r"
type="System.Di agnostics.TextW riterTraceListe ner"
initializeData= "C:\temp\BTFile Acquisition.log " />
<remove type="System.Di agnostics.Defau ltTraceListener " />
</listeners>
</trace>

José
"Daniel Billingsley" <db**********@N O.durcon.SPAAMM .com> wrote in message
news:uF******** *****@tk2msftng p13.phx.gbl...
The documentation on this subject seems to give you 98% of what you need to know. From various sources, I have compiled an understanding that this
should work:

<configuratio n>
<system.diagnos tics>
<switches>
<add name="clientswi tch" value="3" />
</switches>
<trace autoflush="true " indentsize="0">
<listeners>
<add name="traceList ener" type="System.Di agnostics.TextW riterTraceListe ner, system version=1.0.500 0.0, Culture=neutral ,
PublicKeyToken= b77a5c561934e08 9" initializeData= "TraceLog.t xt" />
</listeners>
</trace>
</system.diagnost ics>
</configuration>

(Pardon the formatting, hard to get it pretty with plain text ya know)

When I execute this line in my code:
Trace.WriteLine ("Starting client Form1");
I get a ConfigurationEx ception which says "Couldn't find type for class
System.Diagnost ics.TextWriterT raceListener, system version=1.0.500 0.0, "
etc. (the whole fqn from the config file is shown).

I can't find an actual fully working example on gotdotnet or msdn, and like I said the documentation just points you in the general direction but
doesn't really give you the complete answer.

Is there anybody that has this working and can give me some pointers?

Nov 15 '05 #2
Thanks that seems to work!

Several sections of the documentation state that the syntax for the listener
includes the fully qualified name, and one section explains how you have to
pull that from the GAC. I've found the .NET doc to be very good, but this
topic needs some work. :)

"José Joye" <jo*******@KILL THESPAMSbluewin .ch> wrote in message
news:Ob******** ******@TK2MSFTN GP10.phx.gbl...
The version below works for me. It has the advantage to be .NET version
independant :-)

<trace autoflush="true " indentsize="4">
<listeners>
<!-- With the following line, you define the location where the
tracing will
be stored related to the LocalLogSwitch. To disable output,
comment the next line -->
<add name="BTListene r"
type="System.Di agnostics.TextW riterTraceListe ner"
initializeData= "C:\temp\BTFile Acquisition.log " />
<remove type="System.Di agnostics.Defau ltTraceListener " />
</listeners>
</trace>

José

Nov 15 '05 #3
I more than agree with you!
It took me one year to get the version I have now :-((

José
"Daniel Billingsley" <db**********@N O.durcon.SPAAMM .com> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
Thanks that seems to work!

Several sections of the documentation state that the syntax for the listener includes the fully qualified name, and one section explains how you have to pull that from the GAC. I've found the .NET doc to be very good, but this
topic needs some work. :)

"José Joye" <jo*******@KILL THESPAMSbluewin .ch> wrote in message
news:Ob******** ******@TK2MSFTN GP10.phx.gbl...
The version below works for me. It has the advantage to be .NET version
independant :-)

<trace autoflush="true " indentsize="4">
<listeners>
<!-- With the following line, you define the location where the
tracing will
be stored related to the LocalLogSwitch. To disable output,
comment the next line -->
<add name="BTListene r"
type="System.Di agnostics.TextW riterTraceListe ner"
initializeData= "C:\temp\BTFile Acquisition.log " />
<remove type="System.Di agnostics.Defau ltTraceListener " />
</listeners>
</trace>

José


Nov 15 '05 #4

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

Similar topics

3
1819
by: Simon | last post by:
Hi everyone, I really need help with the following: It's common in app development to create numerous projects under one solution that as a whole combine to become your final application. For example I have a solution that has four subprojects - 3 class libraries and 1 windows forms app. Q - Some of these projects - both class library and win form application
0
1367
by: cnys | last post by:
We have an ASP.NET 2.0 (C#) app and we're trying to add tracing into it. The tracing functionality within .NET is great, but when we output this to a file, it's kind of sparse. So, we're looking for ideas on how to get more tracing info. output to our log file than what's currently output by calling the Write methods. Here are some snippets of what we're thinking of:
0
1341
by: rehto | last post by:
We have an ASP.NET 2.0 (C#) app and we want to enable tracing (see the code snippets below). The first time a user navigates to the app., the tracing works fine (the ASP.NET tracing appears on the screen and writes to a text file). The problem happens any subsequent time the app. is used--tracing doesn't happen. It's as if tracing just turns itself off. So, we only get tracing on the first time the app runs but never any other time. ...
2
1263
by: bonk | last post by:
I am using .NET 2.0 tracing to log messages within my application and app.config (<System.Diagnostics>) to configure it. I would like to be able to configure tracing in a finer grained manner than it is currently possibile out of the box. Especially I would like 1. the filnames where the traceevent end up to be dynamically generated (e.g. based on date and the tracesource). This should be configurable somewhere in the app.config by...
7
11111
by: moondaddy | last post by:
I'm running a wpf windows app and want to add the appSettings element to the config file. when I do, the app wont start up and I get the following error: {"The type initializer for 'System.Windows.Application' threw an exception."} {"The type initializer for 'System.Windows.Navigation.BaseUriHelper' threw an exception."} " at System.Windows.Application..ctor()\r\n at DiagramTool_v1.App..ctor()\r\n at DiagramTool_v1.App.Main() in
3
10604
by: Blasting Cap | last post by:
I am working on a web app that I want to be able to use a separate config file on, in addition to the web.config file that's already working in the application. If I put the following in the web.config file (VS 2005, Framework 2.0), I can retrieve the values fine: <appSettings> <add key="fileInputFolder" value="C:\National City Downloads\test"/> <add key="fileTransaction" value="\Transactions\"/>
12
13439
by: dbuchanan | last post by:
Hello, (Is this the proper newsgroup?) === Background === I am building a solution with two projects. One project is my data access layer which contains my DataSet as an xsd file. The XSD file was built by draging tables from the Data Sources pane. Auto-generated code created the files associated wtih the XSD file (xss,
4
3435
by: =?Utf-8?B?QmlsbCBNaWxk?= | last post by:
Feel free to let me know if there is a better place to post this question I'm a website developer trying to write a Windows Service, and I think I'm running into trouble due to the paradigm shift. In website development, I change the web.config file on the fly without re-building a project. How does this work with the app.config in a Windows Service? It seems like when I update a ConnectionString in app.config after rolling to a...
8
16098
by: Andrus | last post by:
..NET 2 Winforms application. How to create new setting and set it default value in userSettings section of app.config file or overwrite existing setting value ? I found code below in this list which modifies Application setting section but how to add new item to userSettings ? Andrus.
0
9685
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
9538
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
10249
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...
1
10219
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7563
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6804
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
5584
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2937
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.