How to configure ATL trace level and categories in VS2015

懵懂的女人 提交于 2019-12-24 16:20:02

问题


I want to trace the ATL registrar process in a project I'm building in VS2015 (community edition). In this post (third paragraph) it says that the ATL/MFC trace tool has been eliminated.

Unfortunately the VS 2015 documentation does not reflect that change. It still talks about the trace tool (first paragraph under Remarks).

My question is how do you specify that you want to see all messages related to the ATL registrar?


回答1:


I studied the source code for ATL (which is installed as part of VS). In particular atltrace.h. I found this:

  1. The class CTrace controls which categories are traced and the trace level
  2. The static unsigned member m_nLevel is the trace level.
  3. Lower values of m_nLevel cause more tracing.
  4. Zero causes all traces to be output
  5. The value CTrace::DisableTracing explicitly disables all tracing
  6. The static unsigned member, m_nCategory, is a bit mask
  7. The template class CTraceCategoryEx pre-defines 23 different categories
  8. TraceUser and TraceUtil categories are both 0x80000. I think this is a bug and TraceUser should be 0x800000
  9. CTrace::GetLevel() gets current trace level. Default is zero
  10. CTrace::SetLevel() sets trace level
  11. CTrace::GetCategories() returns category bit mask
  12. CTrace::SetCategories() sets category bit mask
  13. For a given trace level and category CTrace::IsTracingEnabled() returns enablement
  14. CTrace::RegisterCategory() registers a category with given name and index
  15. There are 9 slots for user defined categories.
  16. If _DEBUG is not defined before atltrace.h CTrace is not defined.
  17. There's less than twenty or so comments in 670 lines of code.
  18. Not more than 5 comments are useful in understanding code operation
  19. There is a bizarre enum in CTrace that defines several unrelated constants.
  20. The constant EnableAllCategories (unsigned int as bit mask) and DisableTracing (unsigned int) happen to have the same values and one is assigned to the other.

Answer to my question: nothing is needed to see all tracing related to Registrar, except debug build, and something to view messages, like DebugView.



来源:https://stackoverflow.com/questions/34689450/how-to-configure-atl-trace-level-and-categories-in-vs2015

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!