Problem with TextwriterTraceListener - DOTNET

This is a discussion on Problem with TextwriterTraceListener - DOTNET ; Hello, My code is using a class inherited from TextWriterTraceLister, creating a new object on Application_Start and inserting it in the listeners collection. This has run for years,but on a new 2003 server with all last fixes, I am unable ...

+ Reply to Thread
Results 1 to 2 of 2

Problem with TextwriterTraceListener

  1. Default Problem with TextwriterTraceListener

    Hello,

    My code is using a class inherited from TextWriterTraceLister, creating a
    new object on Application_Start and inserting it in the listeners
    collection.
    This has run for years,but on a new 2003 server with all last fixes, I am
    unable to get a trace, it seems that our code is not called, no trace file
    is writen on disk.
    trying a remote debug with vs2005, we step in Application_Start after
    changing web.config, and then it start tracing. But unfortunately, we were
    unable to do this twice, changing web.config doesn't trigger
    Application_Start anymore.
    What could be the reason ?

    Thanks for help
    CS



  2. Default RE: Problem with TextwriterTraceListener

    Hello CS,

    From your description, you're programmatically register a custom
    TraceWriter(derived from TextTraceWriter) in ASP.NET application in
    Applicaiton_Start event, however, after deploy on a new windows 2003 server
    box, you found that custom trace writer not work, correct?

    I've also performed some tests on my side, I've tested create and
    registering a custom TextTraceWRiter in applicaiton_start event and deploy
    the application on both XP and 2003 server boxes, both of them work.
    Therefore, I think this approach itself should be supported and reasonable.
    My code in Application_Start(global.asax) is also very straightforward:

    void Application_Start(object sender, EventArgs e)
    {
    ClassLibrary1.CustomTextTraceWriter cttrace = new
    ClassLibrary1.CustomTextTraceWriter(@"E:\temp\log_temp\dynamic_trace_log.txt
    ");
    cttrace.Name = "dynamic_trace_writer";
    System.Diagnostics.Trace.Listeners.Add(cttrace);
    }

    For the problem you met, I think it is likely due to something incorrectly
    with the server environment. To first isolate the problem symptom, I would
    suggest you perform the following tests:

    ** Since ASP.NET 2.0 web site support precompiled and non-precompiled
    deployment model. You can try both approaches to deploy your web
    application on that server to see whether it works

    ** You can create a new ASP.NET 2.0 web application which mainly contains
    the trace writer registering and using code to see whether it also suffer
    the problem on that server.


    for checking the regisered trace listeners, currently I simply loop through
    and printout all the registered listeners in a page's code. e.g.

    ========

    protected void Button1_Click(object sender, EventArgs e)
    {
    foreach (TraceListener listener in
    System.Diagnostics.Trace.Listeners)
    {
    Response.Write("<br/>" + listener.Name + ": " +
    listener.GetType());
    }
    }
    ===========

    You can also put such a simple page to verify the trace listner collection
    of the running application.

    If you have any other finding or anything I've missed, please feel free to
    post here.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    ==================================================

    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscripti...ult.aspx#notif
    ications.



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project ****ysis and dump ****ysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscripti...t/default.aspx.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.



+ Reply to Thread

Similar Threads

  1. Errors using TextWriterTraceListener
    By Application Development in forum DOTNET
    Replies: 0
    Last Post: 08-11-2007, 03:22 PM
  2. Problem with TextwriterTraceListener
    By Application Development in forum DOTNET
    Replies: 0
    Last Post: 08-08-2007, 08:05 AM
  3. Replies: 4
    Last Post: 10-24-2006, 08:35 PM
  4. Replies: 0
    Last Post: 10-19-2005, 02:43 AM
  5. Replies: 0
    Last Post: 02-18-2005, 10:56 AM