DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 9 Aug 2007 12:58:43 +0200,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    WT am
          2    (Steven Cheng[MSFT])


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
Date:Thu, 9 Aug 2007 12:58:43 +0200   Author:  

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/subscriptions/managednewsgroups/default.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 analysis and dump analysis 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/subscriptions/support/default.aspx.

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

This posting is provided "AS IS" with no warranties, and confers no rights.
Date:Fri, 10 Aug 2007 05:28:25 GMT   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us