469,568 Members | 1,372 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,568 developers. It's quick & easy.

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 9273
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by cnys | last post: by
reply views Thread by rehto | last post: by
2 posts views Thread by bonk | last post: by
3 posts views Thread by Blasting Cap | last post: by
4 posts views Thread by =?Utf-8?B?QmlsbCBNaWxk?= | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.