What is the difference between Trace and Debug?

Answers were Sorted based on User's Feedback



What is the difference between Trace and Debug?..

Answer / krishpuneet

Trace and Debug - There are two main classes that deal with
tracing - Debug and Trace. They both work in a similar way -
the difference is that tracing from the Debug class only
works in builds that have the DEBUG symbol defined, whereas
tracing from the Trace class only works in builds that have
the TRACE symbol defined. Typically this means that you
should use System.Diagnostics.Trace.WriteLine for tracing
that you want to work in debug and release builds, and
System.Diagnostics.Debug.WriteLine for tracing that you
want to work only in debug builds.

Tracing is actually the process of collecting information
about the program's execution. Debugging is the process of
finding & fixing errors in our program. Tracing is the
ability of an application to generate information about its
own execution. The idea is that subsequent analysis of this
information may help us understand why a part of the
application is not behaving as it should and allow
identification of the source of the error.

We shall look at two different ways of implementing tracing
in .NET via the System.Web.TraceContext class via the
System.Diagnostics.Trace and System.Diagnostics.Debug
classes. Tracing can be thought of as a better alternative
to the response.writes we used to put in our classic ASP3.0
code to help debug pages.

If we set the Tracing attribute of the Page Directive to
True, then Tracing is enabled. The output is appended in
the web form output. Messeges can be displayed in the Trace
output using Trace.Warn & Trace.Write.

NOTE The only difference between Trace.Warn & Trace.Write
is that the former has output in red color. If the trace is
false, there is another way to enable tracing. This is done
through the application level. We can use the web.config
file and set the trace attribute to true. Here we can set
<trace enabled=false .../>

Note that the Page Directive Trace attribute has precedence
over th application level trace attribute of web.config.
While using application level tracing, we can view the
trace output in the trace.axd file of the project.

Is This Answer Correct ?    1 Yes 1 No

What is the difference between Trace and Debug?..

Answer / rajeev.varshney5

Trace & Debug :
Debug : When the Developer works on the Project and Solve the Problem of Error at the perticuler time by the help of F10 & F11. and We can say that Debugging is the process of
finding & fixing errors in our program.

Tracing : Tracing is the process of collecting Information of program's execution. Or We can say that tracing is used to see the Diagnostic Information (Troubleshooting Information) that contains the Session, Execution time,Http..etc...

Tracing is two types..
1)Page Leve Tracing.
2) Application Level Tracing.

1) Page Level Tracing : It contain the Diagonstic information of a perticular page..it can be done by the help of Trace=true;
if(Request.QueryString["trace']=="true")
{
Trace.IsEnabled=True;
}

2) Application Level : When we don't have information that Which page contains the Error then We used Application Level Tracing.
It contains the following Property.
1) enabled=True;
2) pageOutput="true"
3)RequestLimit=10
4)TraceMode=SortByTime
5) LocalOnly=false;
6) MostRecent=false;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

What is the meaning of TestApi?

0 Answers  


Which keyword you should use for class not to extend? Which keyword to be used for making the class accessible within the assembly only what are the authentication mode of ASP.NET How will you call a JavaScript function using code-behind? How will you define the Session Timeout? What are the methods to validate client-side whether the input is a correct Date format? You want to write a log when ASP.NET application starts. Which is the best place to write that peice of code? What are the page load events and what is there order? What is the difference between abstract class and interface? What are the differences between DataSet and DataReader? What are the two properties other than DataSource, which is required to populate the Drop Down Menu? What is difference between String and StringBuilder Classes? What are differences between Custom control and User control?

1 Answers   Ignis Technologies,


what is Theme in Asp.net 2.0

1 Answers   Syntel,


what is the difference between server.Transfer and response.redirect in .net

1 Answers  


If i have 1000 records in dataset, how to do paging?

2 Answers   Mind Tree,






1.What are the types of events in asp.net? 2.what is databind? 3.what is COM objects? 4.Difference between gridview and datalist? 5.what is SOAP? 6.what are contents are available in asp.net page? 7.what are types of error?

1 Answers   CompuRx Infotech, Gemini, Gemini Communication,


State Management (viewstate, session etc)

2 Answers   Syntel,


Why session is necessary in web application?

0 Answers  


What is the difference between session object and application object?

0 Answers  


What is state management in asp.net with example?

0 Answers  


what is usercontrol how we can use acess the controls that are present in the usercontrol in the aspx page suppose we have 2 text boxes in a user control how u can acess the 2 textboxs in the aspx page

1 Answers  


What three Session State providers are available in ASP.NET 1.1? What are the pros and cons of each ?

1 Answers  


Categories