R
Rob Locher
Greetings all, I have a problem with TextWriterTraceListener. I am
trying to discover why a Windows Forms application works on my
development computer, but not on our test computer, so I added many
Trace.Write() calls in the code. The application's config file looks
like this:
<configuration>
<system.diagnostics>
<trace autoflush="true" indentsize="2">
<listeners>
<add name="myListener"
type="System.Diagnostics.TextWriterTraceListener, System,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
initializeData="C:\test\myListener.log" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
On my development computer, the file "C:\test\myListener.log" is
created and written to as expected. On the test computer, nothing
happens! No exception is thrown.
Interestingly, I tried adding the TextWriterTraceListener to the pool
programmatically, by deleting the config file and then by calling the
following method in my class' constructor:
Private Sub AddTextWriterListener()
Dim TextWriterTL_Found As Boolean = False
Dim tl As TraceListener
For Each tl In Trace.Listeners
If TypeOf tl Is TextWriterTraceListener Then
TextWriterTL_Found = True
End If
Next
If Not TextWriterTL_Found Then
Dim fs As New FileStream("C:\test\myListener.log", _
FileMode.Append, FileAccess.Write, FileShare.Write)
Dim twtl As New TextWriterTraceListener(fs)
Trace.Listeners.Add(twtl)
Trace.AutoFlush = True
End If
End Sub
Guess what? It works fine on my development computer, but nothing
happens on the test computer! No file is created, and NO EXCEPTIONS
ARE THROWN.
I checked all the obvious things: I am running the app as a local
administrator on both places, and the folder grants all permissions to
the Everyone group on both places. Both .NET 1.0 and 1.1 are
installed on both computers.
Any assistance would be most gratefully appreciated!
- Rob
trying to discover why a Windows Forms application works on my
development computer, but not on our test computer, so I added many
Trace.Write() calls in the code. The application's config file looks
like this:
<configuration>
<system.diagnostics>
<trace autoflush="true" indentsize="2">
<listeners>
<add name="myListener"
type="System.Diagnostics.TextWriterTraceListener, System,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
initializeData="C:\test\myListener.log" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
On my development computer, the file "C:\test\myListener.log" is
created and written to as expected. On the test computer, nothing
happens! No exception is thrown.
Interestingly, I tried adding the TextWriterTraceListener to the pool
programmatically, by deleting the config file and then by calling the
following method in my class' constructor:
Private Sub AddTextWriterListener()
Dim TextWriterTL_Found As Boolean = False
Dim tl As TraceListener
For Each tl In Trace.Listeners
If TypeOf tl Is TextWriterTraceListener Then
TextWriterTL_Found = True
End If
Next
If Not TextWriterTL_Found Then
Dim fs As New FileStream("C:\test\myListener.log", _
FileMode.Append, FileAccess.Write, FileShare.Write)
Dim twtl As New TextWriterTraceListener(fs)
Trace.Listeners.Add(twtl)
Trace.AutoFlush = True
End If
End Sub
Guess what? It works fine on my development computer, but nothing
happens on the test computer! No file is created, and NO EXCEPTIONS
ARE THROWN.
I checked all the obvious things: I am running the app as a local
administrator on both places, and the folder grants all permissions to
the Everyone group on both places. Both .NET 1.0 and 1.1 are
installed on both computers.
Any assistance would be most gratefully appreciated!
- Rob