Debug类和Trace类之间有什么区别? [英] What’s the difference between the Debug class and Trace class?

查看:134
本文介绍了Debug类和Trace类之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我们的应用程序中编写更好的错误处理和调试逻辑。有人可以解释Debug和Trace类之间的区别吗?文档看起来很相似。我想与NLog一起使用这些类来改进我们的调试工作。

解决方案

Debug Class提供了一组方法和属性这有助于调试您的代码。如果您使用Debug类中的方法打印调试信息并使用断言检查逻辑,则可以使代码更加健壮,而不影响运输产品的性能和代码大小。



您可以使用Trace类中的属性和方法来发布版本。仪器允许您监视在现实生活中运行的应用程序的运行状况。跟踪可帮助您隔离问题并修复它们,而不会影响正在运行的系统。$
调试仅执行生产时间,并且只在发布产品时执行跟踪
测试和优化。 b $ b我们也可以说Debug是在应用程序开发时使用的,
当应用程序部署时使用Trace选项,当跟踪任何错误并将其写入日志文件时

I am attempting to write better error-handling and debug logic in one of our applications. Can someone explain the difference between the Debug and Trace class? The documentation looks pretty similar. I want to use these classes in conjunction with NLog to improve our debugging efforts.

解决方案

Debug Class provides a set of methods and properties that help debug your code. If you use methods in the Debug class to print debugging information and check your logic with assertions, you can make your code more robust without impacting the performance and code size of your shipping product.

You can use the properties and methods in the Trace class to instrument release builds. Instrumentation allows you to monitor the health of your application running in real-life settings. Tracing helps you isolate problems and fix them without disturbing a running system.
debugging perform only production time and tracing is perform when you release your product testing and optimization only.
we can also say that Debug is used at the time of application development, While Trace option is used at the application deployment when any errors will be traced and will be written to log files

这篇关于Debug类和Trace类之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆