Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

TextWriterTraceListener works on one system but not on another

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rob Locher - 14 Sep 2004 15:31 GMT
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
Rob Locher - 14 Sep 2004 20:38 GMT
I figured out my problem.  It was something completely unrelated -- I
was neglecting to copy the essential DLL to the target system.  Sorry
for the waste of bandwidth...

- Rob

> Greetings all, I have a problem with TextWriterTraceListener.

Snip!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.