472,348 Members | 1,429 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,348 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 9406
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...
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...
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...
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...
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...
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...
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...
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...
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...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

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.