473,386 Members | 1,720 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,386 software developers and data experts.

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:

<configuration>
<system.diagnostics>
<switches>
<add name="clientswitch" value="3" />
</switches>
<trace autoflush="true" indentsize="0">
<listeners>
<add name="traceListener" type="System.Diagnostics.TextWriterTraceListener,
system version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" initializeData="TraceLog.txt" />
</listeners>
</trace>
</system.diagnostics>
</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 ConfigurationException which says "Couldn't find type for class
System.Diagnostics.TextWriterTraceListener, system version=1.0.5000.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 9489
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="BTListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\temp\BTFileAcquisition.log" />
<remove type="System.Diagnostics.DefaultTraceListener" />
</listeners>
</trace>

José
"Daniel Billingsley" <db**********@NO.durcon.SPAAMM.com> wrote in message
news:uF*************@tk2msftngp13.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:

<configuration>
<system.diagnostics>
<switches>
<add name="clientswitch" value="3" />
</switches>
<trace autoflush="true" indentsize="0">
<listeners>
<add name="traceListener" type="System.Diagnostics.TextWriterTraceListener, system version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" initializeData="TraceLog.txt" />
</listeners>
</trace>
</system.diagnostics>
</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 ConfigurationException which says "Couldn't find type for class
System.Diagnostics.TextWriterTraceListener, system version=1.0.5000.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*******@KILLTHESPAMSbluewin.ch> wrote in message
news:Ob**************@TK2MSFTNGP10.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="BTListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\temp\BTFileAcquisition.log" />
<remove type="System.Diagnostics.DefaultTraceListener" />
</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**********@NO.durcon.SPAAMM.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
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*******@KILLTHESPAMSbluewin.ch> wrote in message
news:Ob**************@TK2MSFTNGP10.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="BTListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\temp\BTFileAcquisition.log" />
<remove type="System.Diagnostics.DefaultTraceListener" />
</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
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...
0
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...
0
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...
2
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...
7
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...
3
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...
12
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...
4
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...
8
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.