Log4cxx
  1. Log4cxx
  2. LOGCXX-221

ThreadID layout does not match debugger

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.10.0
    • Component/s: Layout
    • Labels:
      None
    • Environment:
      Windows XP SP2.

      Description

      ThreadID gets displayed in hexadecimal. However, Visual Studio debugger displays them in decimal, making it harder to match up.
      Simple modification of file src\main\cpp\loggingevent.cpp at line 200 fixes this:

      Before: apr_snprintf(result, sizeof(result), "0x%.8x", threadId);
      After: apr_snprintf(result, sizeof(result), "%.5d", threadId);

        Activity

        Hide
        Curt Arnold added a comment -

        Rev 612738 makes the format configurable. Change LOG4CXX_WIN32_THREAD_FMTSPEC in src/main/include/log4cxx/private/log4cxx_private.h to "%d" to use a decimal formatted thread id. Most of the changes were making the unit tests handle either a decimal or hex thread id.

        I did not change the default since other tools like Microsoft Spy++ display threads as hex and do not appear to have an option to change to a decimal format. Visual Studio 2008 uses a hex thread ID in the debugger output and a decimal thread ID by default in the threads pane. The threads pane can be configured to use a hex display by right clicking on the ID column header and selecting from the pop up menu. Since the tools that do use a decimal rep are configurable and the ones that use hex do not appear to be configurable, staying with hex as the default seems prudent.

        Show
        Curt Arnold added a comment - Rev 612738 makes the format configurable. Change LOG4CXX_WIN32_THREAD_FMTSPEC in src/main/include/log4cxx/private/log4cxx_private.h to "%d" to use a decimal formatted thread id. Most of the changes were making the unit tests handle either a decimal or hex thread id. I did not change the default since other tools like Microsoft Spy++ display threads as hex and do not appear to have an option to change to a decimal format. Visual Studio 2008 uses a hex thread ID in the debugger output and a decimal thread ID by default in the threads pane. The threads pane can be configured to use a hex display by right clicking on the ID column header and selecting from the pop up menu. Since the tools that do use a decimal rep are configurable and the ones that use hex do not appear to be configurable, staying with hex as the default seems prudent.

          People

          • Assignee:
            Curt Arnold
            Reporter:
            David Bertrand
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development