Uploaded image for project: 'Log4cxx'
  1. Log4cxx
  2. LOGCXX-193

Please rename or remove new local variable "buf" in Logger.h macros

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.10.0
    • Component/s: Appender
    • Labels:
      None
    • Environment:
      All environments.

      Description

      The new logging macros have a dangerous new feature, ie the local variable buf

      #define LOG4CXX_LOG(logger, level, message) { \
      if (logger->isEnabledFor(level)) {\
      ::log4cxx::helpers::MessageBuffer buf; \ <--------------- ****** broke my build!!!
      logger->forcedLog(level, buf.str(buf << message), LOG4CXX_LOCATION); } }

      I upgraded from 0.97 HEAD to 0.10.0 HEAD and my build broke, since my source code also uses many local variables called "buf" which get logged.

      Please consider either eliminating the named local variable altogether, or giving it an implementation-level name, eg _buf_.

      Many thanks!

        Attachments

          Activity

            People

            • Assignee:
              carnold@apache.org Curt Arnold
              Reporter:
              aerskine Allan Erskine
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: