473,700 Members | 2,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to implement Trace best

Hallo,
The best thing would be to implement a trace call in every procedure to
write an entry in the log file:
If MySwitch.TraceV erbose() then trace.writeline ("Procedure xyz started with
Parameters ...")

Unfortuantelly is this a lot of work.
Is there an easier way to implement a good tracing?
How is tracing done in professional applications?
Thanks, Thorsten

Nov 22 '05 #1
2 1361
I don't know about performance overhead issues here, but you could be more
generic by using code like:

Trace.WriteLine ("Entering " + MethodBase.GetC urrentMethod(). ToString () );

and there are probably Reflection methods you could call to enumerate the
parameter names and values.
--
Phil Wilson [MVP Windows Installer]
----
"Thorsten Tarrach" <th********@gmx .de> wrote in message
news:uP******** ******@TK2MSFTN GP10.phx.gbl...
Hallo,
The best thing would be to implement a trace call in every procedure to
write an entry in the log file:
If MySwitch.TraceV erbose() then trace.writeline ("Procedure xyz started with
Parameters ...")

Unfortuantelly is this a lot of work.
Is there an easier way to implement a good tracing?
How is tracing done in professional applications?
Thanks, Thorsten

Nov 22 '05 #2

"Phil Wilson" <ph*********@un isys.spamcom> schrieb im Newsbeitrag
news:OO******** *****@TK2MSFTNG P11.phx.gbl...
I don't know about performance overhead issues here, but you could be more
generic by using code like:

Trace.WriteLine ("Entering " + MethodBase.GetC urrentMethod(). ToString () );
and there are probably Reflection methods you could call to enumerate the
parameter names and values.


Yes, that is a good idea, I can get all methods with the StackTrace.
Unfortunatelly is there no way to get the paramterters passed to that
method.

Next would be error tracing. Can be done the same way, but is there some
kind of event fired, when an error occurs?
Thorsten

Nov 22 '05 #3

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

Similar topics

2
337
by: Thorsten Tarrach | last post by:
Hallo, The best thing would be to implement a trace call in every procedure to write an entry in the log file: If MySwitch.TraceVerbose() then trace.writeline("Procedure xyz started with Parameters ...") Unfortuantelly is this a lot of work. Is there an easier way to implement a good tracing? How is tracing done in professional applications? Thanks, Thorsten
3
2318
by: Jens Alenius | last post by:
I've been looking at the Trace and TraceSwitch Classes i C# and I thrying to make it act more like java log4j. What I want is to add two different tracelisteners (like EventLogTraceListener and TextWriterTraceListener) to the Trace class. I also want them to react on different TraceSwitch Levels. I dont want the windows eventlog to log anything else than errors. The textLog will log on the verbose level. Is there anyone here that knows how to...
5
2225
by: martin | last post by:
Hi, The trace class seems to me to be very usefull however there are a few features of it that have to confused. I am using visual studio 2003. the IDE will not let me write trace.assert(..) or trace.writeLine(..) or trace.writeif(..)
7
1747
by: Brian Henry | last post by:
Hi, I am doing the following stored procedure CREATE PROCEDURE . @sender varchar(50), @subject varchar(400), @messagebody text, @hasAttachments bit, @sentTime DateTime AS
13
1185
by: TJS | last post by:
How can I use trace.warn in a code class. I set the calling aspx page with trace=true but get this error when I put a trace.warn("hello") in my code class ------------------ System.NullReferenceException: Object reference not set to an instance of an object.
1
1090
by: Mukund Patel | last post by:
Hi Friends, I am working on asp.net in .net studio 2005 (Whidbey). I want to write trace in file in my web application. How to implement Diagnostics Trace features in Whidbey. I have written following code in web.config. But it says System.Diagnostics is not a valid child element. <system.diagnostics> <trace autoflush="true">
7
26459
by: Don | last post by:
Can anyone give me an example of implementing ICloneable to give a class I created a "Clone" method so I can make copies of objects. I have no idea where to begin with this. Thanks. - Don
5
19594
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was having a problem in the calling program. I searched online and found suggestions that I return an Array instead so I modified my code (below) to return an Array instead of an ArrayList. Now I get the message when I try to run just my webservice...
7
1736
by: Frank | last post by:
I'm running into trouble and I hope someone can help. I have two assemblies. The first defines a base class and a series of distinct classes based on the base class. Something similar too: // BASE CLASS public class PacketBase { public virtual bool PacketOnReceive() {
2
1248
by: Rick Mavrovik | last post by:
hi one of the pages in my asp.net application is taking very long to load. i want find out what is causing the problem. its probably ajax. i am not finding the asp.net trace any useful, i mean i do not know how to make that trace information useful in diagnosis of this problem..can any one help me in this regard.. direct to any good resource regarding asp.net trace..
0
8709
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8638
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9202
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9058
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
5894
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4395
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4649
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2371
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.