问题
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:
- The class CTrace controls which categories are traced and the trace level
- The static unsigned member m_nLevel is the trace level.
- Lower values of m_nLevel cause more tracing.
- Zero causes all traces to be output
- The value CTrace::DisableTracing explicitly disables all tracing
- The static unsigned member, m_nCategory, is a bit mask
- The template class CTraceCategoryEx pre-defines 23 different categories
- TraceUser and TraceUtil categories are both 0x80000. I think this is a bug and TraceUser should be 0x800000
- CTrace::GetLevel() gets current trace level. Default is zero
- CTrace::SetLevel() sets trace level
- CTrace::GetCategories() returns category bit mask
- CTrace::SetCategories() sets category bit mask
- For a given trace level and category CTrace::IsTracingEnabled() returns enablement
- CTrace::RegisterCategory() registers a category with given name and index
- There are 9 slots for user defined categories.
- If _DEBUG is not defined before atltrace.h CTrace is not defined.
- There's less than twenty or so comments in 670 lines of code.
- Not more than 5 comments are useful in understanding code operation
- There is a bizarre enum in CTrace that defines several unrelated constants.
- 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