What is the difference between debug.write and Trace.write? When should each be used?
Tracing is a process about getting information regarding program's execution. On the other hand debugging is about finding errors in the code.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With