473,386 Members | 1,630 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,386 software developers and data experts.

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.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

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

Trace.WriteLine("Entering " + MethodBase.GetCurrentMethod().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**************@TK2MSFTNGP10.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.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

Nov 22 '05 #2

"Phil Wilson" <ph*********@unisys.spamcom> schrieb im Newsbeitrag
news:OO*************@TK2MSFTNGP11.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.GetCurrentMethod().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
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...
3
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...
5
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 ...
7
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
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 ------------------...
1
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...
7
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
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...
7
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: ...
2
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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...

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.