473,416 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Support of System.Diagnostics.TraceSource in ASP.NET. Please help!

Hi.

Does anybody know if System.Diagnostics.TraceSource is supported under
ASP.NET? I've used this class along with SourceSwitch and
TextWriterTraceListener in Windows apps but this is the first time I attempt
it in a web app. Specifically, does anyone know why the code below works in a
Windows application but not under an ASP.NET application?

What's interesting (frustrating I should say, since I don't understand the
behavior) is that in the web app, the last 2 lines do get executed if you
step through the code. Line oTSource.TraceData (3rd from the bottom) however,
is totally bypassed. In addition if you perform a Rename on the oTSource
object, all of the instances in the code change except again for the line 3rd
from the bottom. So somehow it is clear ASP.NET is not recognizing this line
but I have no idea why.

' set up the trace objects
Dim oTSource As New System.Diagnostics.TraceSource("TSource")
Dim oTSwitch As New System.Diagnostics.SourceSwitch("TSwitch", "Information")
Dim oTListener As New
System.Diagnostics.TextWriterTraceListener("C:\App Log.txt", "TListener")

' assign the switch to the trace source object
oTSource.Switch = oTSwitch

' add the listener to the listeners collection of trace source object
oTSource.Listeners.Add(oTListener)

' remove the default listener
oTSource.Listeners.Remove("Default")

' log a message to the C:\AppLog.txt file. File permissions have to allow
for this.
oTSource.TraceData(Diagnostics.TraceEventType.Info rmation, 1, "Tracing
message")

' flush the trace source to force writing to the file.
oTSource.Flush()

' close it
oTSource.Close()
Regards,
-Alex

Jul 26 '07 #1
0 2496

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Naresh | last post by:
I have been having a problem and I don't know where to go for help. The microsoft support is only for a fees. Can anyone at all please at least point to a site or some place where I can hope for some...
5
by: toby | last post by:
Can any one help? I'm trying to use System.Diagnostics.Process.Start to open legacy MS access aplications (ade and mdb files) and vb 6 .exe's using asp.net. There is something confusing going on?!?...
2
by: Eranga | last post by:
I have a windows application in C# which has the following method public void InitiateSession(string server,string userName, string passWd ) { //To start the command...
4
by: Jiho Han | last post by:
I have the following defined in web.config under <configuration> node: <system.diagnostics> <switches> <add name="MainSwitch" value="4"/> </switches>
2
by: AMDRIT | last post by:
Hello everyone, I have created a custom component and one of its properties is a class object with it's own properties. During runtime, I can assign values to the class object properties just...
11
by: Nurit N | last post by:
This is the third newsgroup that I'm posting my problem. I'm sorry for the multiple posts but the matter becoming urgent. I hope this is the right place for it... I have created a very...
1
by: Ashkan Daie | last post by:
Hi All, When trying to install a performance counter via InstallUtil I get the following exception: Creating performance counter category Enterprise Library Caching. An exception occurred...
2
by: Rupali | last post by:
Hi all, I am tring to call a .vbs file using System.Diagnostics.Process class with following code. Process objProcess = new Process(); objProcess.StartInfo.FileName = "C:\\testScript.vbs";...
0
by: Pawel Pabich | last post by:
Hi, access a file because it's been locked by other process. I create lots of TraceSource obejcts and I suppose that some of the listeners are not closed properly. Is it any way to get all...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.