this is what I want to do.
i have an input box and a submit button. the input gets processed by my
program and it returns the results. depending on the input, not all the
functions in my program are called, some might be called multiple
times, the order of functions called might be different each time. I
would like to log all this, what function actually got called...
this is my plan
create a global string named TRACE
in each function add its name to trace
string processInput1(string input)
{
//process input
....
TRACE = TRACE + "processInput1";
return input
}
but this is method is clumsy. is there a builtin function in dotNet?
please show me a good example.
Thanks in Advance
Aaron 9 1938
Your wish is granted.
The good folks at Microsoft predicted your need eons ago.
From within your ASPX code;
Trace.Write ( whatever you want to be logged );
Place this anywhere in your code, as often as you require.
In your Web.config, look for the following section;
<trace
enabled="true"
requestLimit="100"
pageOutput="false"
traceMode="SortByTime"
localOnly="false"
/>
Make sure to set enabled to "true"; I also like to set localOnly to false
and to increase the requestLimit.
Run your page, do your testing, and then CTRL+N to open a new browser
window. Change the Url to; http://yoursite/trace.axd
or http://yoursite/yourvirtualdir/trace.axd
if you're using virtual directories
You'll be surprised at what you find.
/// M
"Aaron" <ku*****@yahoo.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com... this is what I want to do.
i have an input box and a submit button. the input gets processed by my program and it returns the results. depending on the input, not all the functions in my program are called, some might be called multiple times, the order of functions called might be different each time. I would like to log all this, what function actually got called...
this is my plan create a global string named TRACE in each function add its name to trace
string processInput1(string input) { //process input ...
TRACE = TRACE + "processInput1"; return input }
but this is method is clumsy. is there a builtin function in dotNet? please show me a good example.
Thanks in Advance Aaron
thanks, but i want to save the log into a database text field. how can
i do that?
Regarding the above, I'm assuming that you're using ASP.NET, since you've
included that group in your post. If not, your approach may be slightly
different.
Also, do not include the System.Diagnostics namespace. You want to use the
Trace functionality built directly into the HttpContext.Current class,
rather than a new orphan Trace object. If you include System.Diagnostics,
your trace output will not appear in Trace.axd; rather you will have to
specify a listener.
/// M
"Aaron" <ku*****@yahoo.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com... this is what I want to do.
i have an input box and a submit button. the input gets processed by my program and it returns the results. depending on the input, not all the functions in my program are called, some might be called multiple times, the order of functions called might be different each time. I would like to log all this, what function actually got called...
this is my plan create a global string named TRACE in each function add its name to trace
string processInput1(string input) { //process input ...
TRACE = TRACE + "processInput1"; return input }
but this is method is clumsy. is there a builtin function in dotNet? please show me a good example.
Thanks in Advance Aaron
Hello Aaron,
Look at the System.Diagnostics.Trace class: http://msdn.microsoft.com/library/de...classtopic.asp
--
Matt Berther http://www.mattberther.com this is what I want to do.
i have an input box and a submit button. the input gets processed by my program and it returns the results. depending on the input, not all the functions in my program are called, some might be called multiple times, the order of functions called might be different each time. I would like to log all this, what function actually got called...
this is my plan create a global string named TRACE in each function add its name to trace string processInput1(string input) { //process input ... TRACE = TRACE + "processInput1"; return input } but this is method is clumsy. is there a builtin function in dotNet? please show me a good example.
Thanks in Advance Aaron
also the trace.axd page doesn't show which methods were called.
Ah, in that case you do want to use the Trace in System.Diagnostics, and
write yourself a custom listener that outputs to your database.
I recommend Dan Appleman's eBook "Tracing and Logging with .NET"; a whopping
US$10 through Amazon. Or direct from Desaware's site; http://www.desaware.com/products/boo...ing/index.aspx
Or do some Googling on "System.Diagnostics.Trace" or
"System.Diagnostics.Trace.Listeners.Add"; you should be able to assemble
similar best practices for using Trace, and examples for how to write your
own Listener.
"Aaron" <ku*****@yahoo.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com... thanks, but i want to save the log into a database text field. how can i do that?
Correct; I put a Trace.Write () at the top of my methods when I need to
track the call path.
"Aaron" <ku*****@yahoo.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com... also the trace.axd page doesn't show which methods were called.
Ah, the magic Googlecantation seems to be;
"TraceListener custom database"
"MWells" <outbound__at_sygnal.com> wrote in message
news:eE**************@TK2MSFTNGP14.phx.gbl... Ah, in that case you do want to use the Trace in System.Diagnostics, and write yourself a custom listener that outputs to your database.
I recommend Dan Appleman's eBook "Tracing and Logging with .NET"; a
whopping US$10 through Amazon. Or direct from Desaware's site;
http://www.desaware.com/products/boo...ing/index.aspx
Or do some Googling on "System.Diagnostics.Trace" or "System.Diagnostics.Trace.Listeners.Add"; you should be able to assemble similar best practices for using Trace, and examples for how to write your own Listener.
"Aaron" <ku*****@yahoo.com> wrote in message news:11*********************@c13g2000cwb.googlegro ups.com... thanks, but i want to save the log into a database text field. how can i do that?
thanks, how do i store the trace info into a string variable? since i
already have a db connection and don't need to create a new one.
what are the benfits of using trace than the method i described?
-------------
create a global string named TRACE
in each function add its name to trace
string processInput1(string input)
{
//process input
....
TRACE = TRACE + "processInput1";
return input
} This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ken |
last post by:
I would like to start using EventLogTraceListener, and am running into
a couple of significant limitations:
1) I have found that there is no way to write EventLog entries with
different...
|
by: svenn.are |
last post by:
Hi,
has anybody thought of / already used graphviz to convert the output of
trace.py into a graph? I looked at PyUMLGraph, but 1. PyUMLGraph does
not successfully create a dot file, and 2. I...
|
by: Wilfried Hoermann |
last post by:
Presumably a trivial question...
I want to write trace information from a web service to a
log file using the Trace Class. Is this possible without
closing and opening the Trace in every single...
|
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
...
|
by: JR |
last post by:
I'm experiencing a problem where, for seemingly no reason, trace output
stops being logged (and appearing on my pages.)
trace.enabled suddenly just turns to false.
Any idea why this happens?...
|
by: who be dat? |
last post by:
Hello all. I'm writing an application that is writing trace information
that can be viewed in trace.axd. I would like to rename this and use a
different name specific to my application. I know...
|
by: cameron |
last post by:
I have attempted to lock down the trace.axd file with the standard:
<location path="trace.axd">
<system.web>
<authorization>
<allow roles="SOME GROUP"/>
<deny users="*"/>
</authorization>...
|
by: Joe Rattz |
last post by:
I can't seem to get to trace.axd. I have turned tracing on in web.config.
Here is how I currently have i configured:
<trace
enabled="true"
requestLimit="10"
pageOutput="false"...
|
by: Patrick |
last post by:
When Tracing in ASP.NET, the IIS process (on IIs5.1) is locking on the Trace
file, and I can't read the trace file without restarting the IIS:
Even the following does NOT work (how could I fix...
|
by: Arman Sahakyan |
last post by:
Hi,
I'm an MFC programmer and know little about .NET programming.
Now, for some reasons, I'm developing an ASP .NET application...
What I need to know is how to output into VS's Output Window...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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: 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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
| |