Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between debug.write and Trace.write?

Tags:

What is the difference between debug.write and Trace.write? When should each be used?

like image 688
tush1r Avatar asked Apr 11 '09 14:04

tush1r


People also ask

What is difference between debug and tracing?

Tracing is a process about getting information regarding program's execution. On the other hand debugging is about finding errors in the code.

What is trace in C#?

Tracing helps to see the information of issues at the runtime of the application. By default Tracing is disabled. Tracing has the following important features: We can see the execution path of the page and application using the debug statement. We can access and manipulate trace messages programmatically.


1 Answers

In the typical release build configuration, the Debug class is disabled and does nothing. Trace, however, can still be used in the release. You would typically use Debug.Write for stuff you only need when debugging and which is too verbose for production.

Here's a good article on Debug, Trace etc: http://www.codeproject.com/KB/trace/debugtreatise.aspx

However, I'm more inclined to use logging libraries like log4net which can be reconfigured on the fly. So you can still turn on full logging in production if you're investigating problems with your application.

like image 149
Igor Brejc Avatar answered Sep 28 '22 02:09

Igor Brejc